<!doctype html><html lang=en-us dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="author: Ian
Django 的一些东西 # 一些问题 # 使用字体 zh-cn时如果报错: # OSError: No translation files found for default language zh-cn.
LANGUAGE_CODE = 'zh-Hans' TIME_ZONE = 'Asia/Shanghai' # zh-Hans是简体中文 zh-Hant是繁体中文 # 如果数据库有UTC的时间，那么可以设置： # USE_TZ = True 改为 USE_TZ = False 时区问题 # python3.8/site-packages/django/db/models/fields/init.py:1416: RuntimeWarning: DateTimeField {DATABASEMODEL}.update_time received a naive datetime (2023-09-14 21:55:56) while time zone support is active. warnings.warn(&ldquo;DateTimeField %s received a naive datetime (%s)&rdquo;
这个警告是由于在使用带有时区支持的DateTimeField字段时，传入了一个没有时区信息的datetime对象。要修复这个警告，你可以将传入DateTimeField字段的datetime对象转换为带有时区信息的datetime对象。
有两种方法可以解决这个问题：
使用带有时区信息的datetime对象：确保在创建datetime对象时，使用正确的时区信息。你可以使用pytz库来设置时区信息，例如： from datetime import datetime import pytz # 创建带有时区信息的datetime对象 naive_datetime = datetime(2023, 9, 14, 21, 55, 56) timezone = pytz."><meta name=theme-color content="#FFFFFF"><meta name=color-scheme content="light dark"><meta property="og:title" content="Django的建站的(｡･･)ﾉﾞ"><meta property="og:description" content="author: Ian
Django 的一些东西 # 一些问题 # 使用字体 zh-cn时如果报错: # OSError: No translation files found for default language zh-cn.
LANGUAGE_CODE = 'zh-Hans' TIME_ZONE = 'Asia/Shanghai' # zh-Hans是简体中文 zh-Hant是繁体中文 # 如果数据库有UTC的时间，那么可以设置： # USE_TZ = True 改为 USE_TZ = False 时区问题 # python3.8/site-packages/django/db/models/fields/init.py:1416: RuntimeWarning: DateTimeField {DATABASEMODEL}.update_time received a naive datetime (2023-09-14 21:55:56) while time zone support is active. warnings.warn(&ldquo;DateTimeField %s received a naive datetime (%s)&rdquo;
这个警告是由于在使用带有时区支持的DateTimeField字段时，传入了一个没有时区信息的datetime对象。要修复这个警告，你可以将传入DateTimeField字段的datetime对象转换为带有时区信息的datetime对象。
有两种方法可以解决这个问题：
使用带有时区信息的datetime对象：确保在创建datetime对象时，使用正确的时区信息。你可以使用pytz库来设置时区信息，例如： from datetime import datetime import pytz # 创建带有时区信息的datetime对象 naive_datetime = datetime(2023, 9, 14, 21, 55, 56) timezone = pytz."><meta property="og:type" content="article"><meta property="og:url" content="http://example.org/docs/programmer/cloudnative/notesdjango/"><meta property="article:section" content="docs"><meta property="article:published_time" content="2018-06-07T16:30:18+00:00"><meta property="article:modified_time" content="2018-06-07T16:30:18+00:00"><title>Django的建站的(｡･･)ﾉﾞ | Ian's Blog</title>
<link rel=manifest href=/manifest.json><link rel=icon href=/favicon.png type=image/x-icon><link rel=stylesheet href=/book.min.c58292d36b18b675680ab9baea2029204537b839ea72f258746ec0f32ce8d6c8.css integrity="sha256-xYKS02sYtnVoCrm66iApIEU3uDnqcvJYdG7A8yzo1sg=" crossorigin=anonymous><script defer src=/flexsearch.min.js></script><script defer src=/en.search.min.80b0c12c6a3982c23bab5eb1d10c75b4cf8bfbaa1c7e183729648ce8a09207d7.js integrity="sha256-gLDBLGo5gsI7q16x0Qx1tM+L+6ocfhg3KWSM6KCSB9c=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/><span>Ian's Blog</span></a></h2><div class=book-search><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><ul><li class=book-section-flat><a href=/docs/programmer/>程序员笔记</a><ul><li><input type=checkbox id=section-d5f99046a51e5e750b61f2e037945fcc class=toggle>
<label for=section-d5f99046a51e5e750b61f2e037945fcc class="flex justify-between"><a role=button>基础工具和配置</a></label><ul><li><a href=/docs/programmer/basetc/%E6%96%87%E6%9C%AC%E4%B8%89%E5%89%91%E5%AE%A2/>文本三剑客</a></li><li><a href=/docs/programmer/basetc/tmux/>Tmux使用笔记</a></li><li><a href=/docs/programmer/basetc/obsidian%E6%80%9D%E7%BB%B4%E5%AF%BC%E5%9B%BE%E6%8F%92%E4%BB%B6/>Obsidian思维导图插件</a></li><li><a href=/docs/programmer/basetc/for_china/>各个软件换源</a></li><li><a href=/docs/programmer/basetc/tipsofvim/>tip Of vim</a></li><li><a href=/docs/programmer/basetc/editer/>编辑器使用</a></li><li><a href=/docs/programmer/basetc/bash/>Bash</a></li><li><a href=/docs/programmer/basetc/gitbook/>Gitbook</a></li><li><a href=/docs/programmer/basetc/vim/>Vim</a></li><li><a href=/docs/programmer/basetc/%E5%AE%88%E6%8A%A4%E8%BF%9B%E7%A8%8B/>supervisor</a></li></ul></li><li><input type=checkbox id=section-8658298e10b544e890095f646916165a class=toggle checked>
<label for=section-8658298e10b544e890095f646916165a class="flex justify-between"><a href=/docs/programmer/cloudnative/>云原生</a></label><ul><li><input type=checkbox id=section-31d3b02fd4a132635e483e7e756058ea class=toggle>
<label for=section-31d3b02fd4a132635e483e7e756058ea class="flex justify-between"><a href=/docs/programmer/cloudnative/redis/>中间件</a></label><ul><li><a href=/docs/programmer/cloudnative/redis/python-redis-%E5%AE%A2%E6%88%B7%E7%AB%AF/>Python Redis 客户端</a></li><li><a href=/docs/programmer/cloudnative/redis/bigkey-and-hotkey/>大key、热key问题</a></li><li><a href=/docs/programmer/cloudnative/redis/the-basics-of-redis/>Redis基础</a></li><li><a href=/docs/programmer/cloudnative/redis/advanced-knowledge-of-redis/>Redis进阶</a></li><li><a href=/docs/programmer/cloudnative/redis/%E4%BD%BF%E7%94%A8%E5%91%BD%E4%BB%A4/>Redis常用命令</a></li></ul></li><li><input type=checkbox id=section-62d608ed890b3abc76dae78ccfcab912 class=toggle>
<label for=section-62d608ed890b3abc76dae78ccfcab912 class="flex justify-between"><a role=button>k8s</a></label><ul><li><a href=/docs/programmer/cloudnative/k8s/elk%E5%9C%A8k8s%E4%B8%8A%E7%9A%84%E9%83%A8%E7%BD%B2%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B/>elk在k8s上的部署使用示例</a></li><li><a href=/docs/programmer/cloudnative/k8s/k8s-%E9%85%8D%E5%A5%97%E8%AF%B4%E6%98%8E/>k8s 配套说明</a></li><li><a href=/docs/programmer/cloudnative/k8s/k8s-%E6%8A%80%E6%9C%AF%E5%88%86%E4%BA%AB/>k8s技术分享</a></li><li><a href=/docs/programmer/cloudnative/k8s/k8s%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4%E5%92%8C%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E8%A7%A3%E6%9E%90/>k8s学习-常用命令和配置文件</a></li><li><a href=/docs/programmer/cloudnative/k8s/argo-workflow%E6%80%A7%E8%83%BD%E6%B5%8B%E8%AF%95%E5%92%8C%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF%E5%88%86%E6%9E%90/>Argo Workflow性能测试和使用场景分析</a></li><li><a href=/docs/programmer/cloudnative/k8s/argo-%E4%BD%BF%E7%94%A8%E8%AE%B0%E5%BD%95/>Argo 使用记录</a></li></ul></li><li><input type=checkbox id=section-b828bf3d116bc282da9db25a06bf908e class=toggle>
<label for=section-b828bf3d116bc282da9db25a06bf908e class="flex justify-between"><a role=button>中间件</a></label><ul><li><a href=/docs/programmer/cloudnative/middleware/kafka-%E5%AE%89%E8%A3%85%E5%92%8C%E4%BD%BF%E7%94%A8/>Kafka 安装和使用</a></li></ul></li><li><a href=/docs/programmer/cloudnative/%E5%AE%B9%E5%99%A8/note-of-podman/>Podman</a></li><li><a href=/docs/programmer/cloudnative/nginx%E5%AE%9E%E7%94%A8%E9%85%8D%E7%BD%AE/>Nginx实用配置</a></li><li><a href=/docs/programmer/cloudnative/uwsgi-%E5%A4%84%E7%90%86%E8%AE%B0%E5%BD%95/>uwsgi 处理记录</a></li><li><a href=/docs/programmer/cloudnative/note-of-docker/>Docker</a></li><li><a href=/docs/programmer/cloudnative/%E5%AE%B9%E5%99%A8/note-of-docker/>Docker</a></li><li><a href=/docs/programmer/cloudnative/fastapi/>Django的建站的(｡･･)ﾉﾞ</a></li><li><a href=/docs/programmer/cloudnative/nginx-%E9%AB%98%E5%8F%AF%E7%94%A8/>Nginx高可用</a></li><li><a href=/docs/programmer/cloudnative/notesdjango/ class=active>Django的建站的(｡･･)ﾉﾞ</a></li><li><a href=/docs/programmer/cloudnative/sonar-%E4%BB%A3%E7%A0%81%E9%9D%99%E6%80%81%E6%A3%80%E6%9F%A5/>Sonar 代码静态检查</a></li></ul></li><li><input type=checkbox id=section-883e27361d38e16afb68faff3435ac0b class=toggle>
<label for=section-883e27361d38e16afb68faff3435ac0b class="flex justify-between"><a role=button>机器学习</a></label><ul><li><a href=/docs/programmer/ml/stable-diffusion/>AI画图</a></li><li><a href=/docs/programmer/ml/%E7%88%AC%E8%99%AB/>爬虫</a></li><li><a href=/docs/programmer/ml/paddle/>Paddle</a></li><li><a href=/docs/programmer/ml/tensorflow/>Tensorflow</a></li><li><a href=/docs/programmer/ml/opencv/>OpenCV</a></li><li><a href=/docs/programmer/ml/yolo/>Demo Test项目中的一些东西</a></li><li><a href=/docs/programmer/ml/%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E5%B8%B8%E7%94%A8%E5%BA%93%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95/>机器学习库</a></li></ul></li><li><input type=checkbox id=section-0bf4f4329214e20fa67ca3e12c6aad0c class=toggle>
<label for=section-0bf4f4329214e20fa67ca3e12c6aad0c class="flex justify-between"><a role=button>平台</a></label><ul><li><a href=/docs/programmer/platforms/ubuntu/>Ubuntu</a></li><li><a href=/docs/programmer/platforms/%E9%98%BF%E9%87%8C%E4%BA%91%E4%BD%BF%E7%94%A8/>阿里云使用</a></li><li><a href=/docs/programmer/platforms/wps-for-linux/>WPS for Linux</a></li><li><a href=/docs/programmer/platforms/appsflyer/>AppsFlyer-外网移动归因营销分析平台</a></li></ul></li><li><input type=checkbox id=section-bf4e0d6f0b81f7b3ec08ed1fc66b874d class=toggle>
<label for=section-bf4e0d6f0b81f7b3ec08ed1fc66b874d class="flex justify-between"><a href=/docs/programmer/langs/>编程语言</a></label><ul><li><input type=checkbox id=section-771df6c720301e69f1715f7fc174ac3d class=toggle>
<label for=section-771df6c720301e69f1715f7fc174ac3d class="flex justify-between"><a role=button>Python</a></label><ul><li><a href=/docs/programmer/langs/python/sqlalchemy/>SqlAlchemy - 数据库Orm</a></li><li><a href=/docs/programmer/langs/python/pypi/>PyPi使用说明</a></li><li><a href=/docs/programmer/langs/python/pytest/>PyTest</a></li><li><a href=/docs/programmer/langs/python/paramiko-%E4%BD%BF%E7%94%A8-sshsftp/>Paramiko 使用 Ssh&amp;sftp</a></li><li><a href=/docs/programmer/langs/python/%E5%A4%9A%E7%BA%BF%E7%A8%8B%E5%A4%9A%E8%BF%9B%E7%A8%8B/>Python 多线程多进程</a></li><li><a href=/docs/programmer/langs/python/notespython/>Python 常用库</a></li><li><a href=/docs/programmer/langs/python/notespython/>Python 笔记</a></li><li><a href=/docs/programmer/langs/python/py%E5%B0%8F%E5%B7%A5%E5%85%B7%E5%92%8C%E5%8A%9F%E8%83%BD%E6%80%A7%E6%96%B9%E6%B3%95/>Py小工具和功能性方法</a></li><li><a href=/docs/programmer/langs/python/notespython/>解决问题</a></li></ul></li><li><input type=checkbox id=section-9f8ac8f06e138c7ac13ff61f23b4d497 class=toggle>
<label for=section-9f8ac8f06e138c7ac13ff61f23b4d497 class="flex justify-between"><a role=button>Golang</a></label><ul><li><a href=/docs/programmer/langs/golang/advanced-knowledge-of-golang/>Golang进阶笔记</a></li><li><a href=/docs/programmer/langs/golang/noteofgoexp/>Golang进阶笔记</a></li><li><a href=/docs/programmer/langs/golang/note-of-golang/>Golang笔记</a></li><li><a href=/docs/programmer/langs/golang/noteofgolang/>Golang笔记</a></li></ul></li><li><a href=/docs/programmer/langs/cmake/>CMake 使用Tips</a></li><li><a href=/docs/programmer/langs/tips-of-debugers/>Tips of debuggers</a></li><li><a href=/docs/programmer/langs/tips-of-markdown/>Tips of MarkDown</a></li><li><a href=/docs/programmer/langs/java/notesjava/>愉快的Java(happy to learn the fuck java)</a></li><li><a href=/docs/programmer/langs/note-for-fmtdata/>数据格式笔记</a></li></ul></li><li><input type=checkbox id=section-de7bfad1d124522974cdf8addfbb23f2 class=toggle>
<label for=section-de7bfad1d124522974cdf8addfbb23f2 class="flex justify-between"><a role=button>Net</a></label><ul><li><a href=/docs/programmer/net/%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/>网络编程</a></li><li><a href=/docs/programmer/net/nginx%E5%AE%9E%E7%94%A8%E9%85%8D%E7%BD%AE/>Nginx实用配置</a></li><li><a href=/docs/programmer/net/tips-of-grpc/>gRpc使用小记</a></li><li><a href=/docs/programmer/net/epoll%E5%AE%9E%E7%8E%B0/>Epoll实现</a></li><li><a href=/docs/programmer/net/net/>Epoll实现</a></li></ul></li><li><input type=checkbox id=section-4446dd07527142b855f26d7cc8f0e617 class=toggle>
<label for=section-4446dd07527142b855f26d7cc8f0e617 class="flex justify-between"><a href=/docs/programmer/database/>Database</a></label><ul><li><a href=/docs/programmer/database/mongodb/>Mongodb使用记录</a></li><li><a href=/docs/programmer/database/dgraph/>Dgraph使用小记</a></li><li><a href=/docs/programmer/database/note-of-db-data-mongodb/>数据库-MongoDB篇</a></li><li><a href=/docs/programmer/database/note-of-db-data/>数据库-MongoDB篇</a></li><li><a href=/docs/programmer/database/note-of-db-data-mysql/>数据库-MySQL篇</a></li></ul></li><li><input type=checkbox id=section-7e5360c5e7954906b897ed79085884b6 class=toggle>
<label for=section-7e5360c5e7954906b897ed79085884b6 class="flex justify-between"><a href=/docs/programmer/gui/>图形用户界面-GUI</a></label><ul><li><a href=/docs/programmer/gui/pyinstaller-python%E6%89%93%E5%8C%85/>python打包</a></li><li><a href=/docs/programmer/gui/pyinstaller/>python打包</a></li><li><a href=/docs/programmer/gui/qt/>Qt/PySide</a></li><li><a href=/docs/programmer/gui/noteofvn_py/>Vn.Py学习笔记（Python交易平台框架）</a></li><li><a href=/docs/programmer/gui/vn.py%E7%AC%94%E8%AE%B0-%E4%BA%A4%E6%98%93%E5%B9%B3%E5%8F%B0%E5%AE%A2%E6%88%B7%E7%AB%AF/>Vn.Py学习笔记（Python交易平台框架）</a></li><li><a href=/docs/programmer/gui/notespython/>图形化界面 （Python Gui）</a></li><li><a href=/docs/programmer/gui/notespython/>图形化界面 （Python Gui）</a></li></ul></li><li><input type=checkbox id=section-ddcbe632dc99a9fb372422dada8ee641 class=toggle>
<label for=section-ddcbe632dc99a9fb372422dada8ee641 class="flex justify-between"><a role=button>OS操作系统问题处理</a></label><ul><li><a href=/docs/programmer/os/install_some/>安装问题</a></li><li><a href=/docs/programmer/os/android/>安卓</a></li><li><a href=/docs/programmer/os/freebsd/>FreeBSD</a></li><li><a href=/docs/programmer/os/note-of-linux/>Linux 笔记</a></li><li><a href=/docs/programmer/os/npm/>Npm</a></li><li><a href=/docs/programmer/os/git/>Git</a></li><li><a href=/docs/programmer/os/problem-of-windows/>Windows 爬坑记</a></li><li><a href=/docs/programmer/os/tips-of-problems/>解决问题记录笔记</a></li></ul></li><li><input type=checkbox id=section-d325c59fc6513e1b1e05a60b192d4973 class=toggle>
<label for=section-d325c59fc6513e1b1e05a60b192d4973 class="flex justify-between"><a href=/docs/programmer/hardware/>硬件</a></label><ul><li><a href=/docs/programmer/hardware/raspberrypi/>Raspberry Pi</a></li><li><a href=/docs/programmer/hardware/screen/>Screen</a></li></ul></li></ul></li><li class=book-section-flat><span>建模和游戏</span><ul><li><a href=/docs/3dgame/blender/>Blender</a></li><li><a href=/docs/3dgame/noteofue4/>UE4 笔记</a></li></ul></li><li class=book-section-flat><a href=/docs/example/>Hugo特殊Markdown语法说明</a><ul><li><a href=/docs/example/table-of-contents/>Table of Contents</a><ul><li><a href=/docs/example/table-of-contents/with-toc/>With ToC</a></li><li><a href=/docs/example/table-of-contents/without-toc/>Without ToC</a></li></ul></li><li><a href=/docs/example/shortcodes/buttons/>Buttons</a></li><li><a href=/docs/example/shortcodes/columns/>Columns</a></li><li><a href=/docs/example/shortcodes/details/>Details</a></li><li><a href=/docs/example/shortcodes/expand/>Expand</a></li><li><a href=/docs/example/shortcodes/hints/>Hints</a></li><li><a href=/docs/example/shortcodes/tabs/>Tabs</a></li></ul></li></ul><ul><li><a href=/posts/>Blog</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/svg/menu.svg class=book-icon alt=Menu>
</label><strong>Django的建站的(｡･･)ﾉﾞ</strong>
<label for=toc-control><img src=/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#一些问题>一些问题</a><ul><li><a href=#使用字体-zh-cn时如果报错>使用字体 <code>zh-cn</code>时如果报错:</a></li><li><a href=#时区问题>时区问题</a></li></ul></li><li><a href=#daemon-命令>daemon 命令</a><ul><li><a href=#示例如下>示例如下:</a></li></ul></li><li><a href=#利用nginxfd反向代理解决跨域问题>利用nginxfd反向代理解决跨域问题</a><ul><li></li></ul></li><li><a href=#django-的前端相关>Django 的前端相关</a><ul><li></li><li><a href=#版本>版本</a></li><li><a href=#mvc>MVC</a></li></ul></li><li><a href=#简介>简介</a><ul><li><a href=#试一下>试一下?</a></li><li><a href=#结构>结构</a></li><li><a href=#得知结构之后>得知结构之后</a></li><li><a href=#这下可以很厉害了>这下可以很厉害了</a></li></ul></li><li><a href=#我爱java-2018年6月24日16点40分的我由衷的写到>我爱Java 2018年6月24日16点40分的我由衷的写到</a><ul><li></li><li><a href=#注意>注意</a></li></ul></li><li><a href=#ssl加密https配置>SSl加密，https配置</a><ul><li><a href=#之前写的文档>之前写的文档</a></li><li><a href=#附>附</a></li></ul></li></ul><ul><li><ul><li><a href=#路由配置登陆访问>路由配置登陆访问</a></li></ul></li></ul></nav></aside></header><article class=markdown><p>author: Ian</p><h1 id=django-的一些东西>Django 的一些东西
<a class=anchor href=#django-%e7%9a%84%e4%b8%80%e4%ba%9b%e4%b8%9c%e8%a5%bf>#</a></h1><p><img src=http://lofrev.net/wp-content/photos/2017/04/http_logo_dpwnload.png alt="http server/client"></p><h2 id=一些问题>一些问题
<a class=anchor href=#%e4%b8%80%e4%ba%9b%e9%97%ae%e9%a2%98>#</a></h2><h3 id=使用字体-zh-cn时如果报错>使用字体 <code>zh-cn</code>时如果报错:
<a class=anchor href=#%e4%bd%bf%e7%94%a8%e5%ad%97%e4%bd%93-zh-cn%e6%97%b6%e5%a6%82%e6%9e%9c%e6%8a%a5%e9%94%99>#</a></h3><blockquote><p>OSError: No translation files found for default language zh-cn.</p></blockquote><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span>LANGUAGE_CODE <span style=color:#f92672>=</span> <span style=color:#e6db74>&#39;zh-Hans&#39;</span>
</span></span><span style=display:flex><span>TIME_ZONE <span style=color:#f92672>=</span> <span style=color:#e6db74>&#39;Asia/Shanghai&#39;</span>
</span></span><span style=display:flex><span><span style=color:#75715e># zh-Hans是简体中文 zh-Hant是繁体中文</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#75715e># 如果数据库有UTC的时间，那么可以设置：</span>
</span></span><span style=display:flex><span><span style=color:#75715e># USE_TZ = True 改为</span>
</span></span><span style=display:flex><span>USE_TZ <span style=color:#f92672>=</span> <span style=color:#66d9ef>False</span>
</span></span></code></pre></div><h3 id=时区问题>时区问题
<a class=anchor href=#%e6%97%b6%e5%8c%ba%e9%97%ae%e9%a2%98>#</a></h3><blockquote><p>python3.8/site-packages/django/db/models/fields/<strong>init</strong>.py:1416: RuntimeWarning: DateTimeField {DATABASEMODEL}.update_time received a naive datetime (2023-09-14 21:55:56) while time zone support is active.
warnings.warn(&ldquo;DateTimeField %s received a naive datetime (%s)&rdquo;</p></blockquote><p>这个警告是由于在使用带有时区支持的DateTimeField字段时，传入了一个没有时区信息的datetime对象。要修复这个警告，你可以将传入DateTimeField字段的datetime对象转换为带有时区信息的datetime对象。</p><p>有两种方法可以解决这个问题：</p><ol><li>使用带有时区信息的datetime对象：确保在创建datetime对象时，使用正确的时区信息。你可以使用<code>pytz</code>库来设置时区信息，例如：</li></ol><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#f92672>from</span> datetime <span style=color:#f92672>import</span> datetime
</span></span><span style=display:flex><span><span style=color:#f92672>import</span> pytz
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#75715e># 创建带有时区信息的datetime对象</span>
</span></span><span style=display:flex><span>naive_datetime <span style=color:#f92672>=</span> datetime(<span style=color:#ae81ff>2023</span>, <span style=color:#ae81ff>9</span>, <span style=color:#ae81ff>14</span>, <span style=color:#ae81ff>21</span>, <span style=color:#ae81ff>55</span>, <span style=color:#ae81ff>56</span>)
</span></span><span style=display:flex><span>timezone <span style=color:#f92672>=</span> pytz<span style=color:#f92672>.</span>timezone(<span style=color:#e6db74>&#34;Asia/Shanghai&#34;</span>)
</span></span><span style=display:flex><span>aware_datetime <span style=color:#f92672>=</span> timezone<span style=color:#f92672>.</span>localize(naive_datetime)
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#75715e># 将带有时区信息的datetime对象传递给DateTimeField字段</span>
</span></span><span style=display:flex><span>ScannerDevice<span style=color:#f92672>.</span>update_time <span style=color:#f92672>=</span> aware_datetime
</span></span></code></pre></div><ol start=2><li>将DateTimeField字段的<code>auto_now</code>或<code>auto_now_add</code>属性设置为<code>True</code>：这将自动将字段的值设置为当前的带有时区信息的datetime对象。例如：</li></ol><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#f92672>from</span> django.db <span style=color:#f92672>import</span> models
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>class</span> <span style=color:#a6e22e>DATABASEMODEL</span>(models<span style=color:#f92672>.</span>Model):
</span></span><span style=display:flex><span>    update_time <span style=color:#f92672>=</span> models<span style=color:#f92672>.</span>DateTimeField(auto_now<span style=color:#f92672>=</span><span style=color:#66d9ef>True</span>)
</span></span></code></pre></div><p>通过以上两种方法之一，你可以修复这个警告并确保正确处理时区信息。</p><h2 id=daemon-命令>daemon 命令
<a class=anchor href=#daemon-%e5%91%bd%e4%bb%a4>#</a></h2><blockquote><p>Django 的 BaseCommand怎么使用？</p></blockquote><p><strong>AI:</strong>
要使用 Django 的 BaseCommand，你需要按照以下步骤操作：</p><ol><li>创建一个新的 Python 模块或文件，例如 <code>myapp/management/commands/mycommand.py</code> <strong>这里的路径很重要</strong></li><li>在 <code>mycommand.py</code> 文件中导入必要的模块和类：</li></ol><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#f92672>from</span> django.core.management.base <span style=color:#f92672>import</span> BaseCommand
</span></span></code></pre></div><ol start=3><li>创建一个继承自 <code>BaseCommand</code> 的子类，并实现 <code>handle()</code> 方法来定义你的命令逻辑。例如：</li></ol><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#66d9ef>class</span> <span style=color:#a6e22e>Command</span>(BaseCommand):
</span></span><span style=display:flex><span>    help <span style=color:#f92672>=</span> <span style=color:#e6db74>&#39;My custom command&#39;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>    <span style=color:#66d9ef>def</span> <span style=color:#a6e22e>handle</span>(self, <span style=color:#f92672>*</span>args, <span style=color:#f92672>**</span>options):
</span></span><span style=display:flex><span>        <span style=color:#75715e># 在这里编写你的命令逻辑</span>
</span></span><span style=display:flex><span>        self<span style=color:#f92672>.</span>stdout<span style=color:#f92672>.</span>write(<span style=color:#e6db74>&#39;Hello, world!&#39;</span>)
</span></span></code></pre></div><ol start=4><li>在 Django 项目中运行你的命令。使用以下命令格式：</li></ol><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>python manage.py mycommand
</span></span></code></pre></div><p>这将执行你在 <code>handle()</code> 方法中定义的逻辑。
你还可以在 <code>handle()</code> 方法中使用 <code>self.stdout.write()</code> 方法来输出信息到命令行。</p><h3 id=示例如下>示例如下:
<a class=anchor href=#%e7%a4%ba%e4%be%8b%e5%a6%82%e4%b8%8b>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#f92672>from</span> django.core.management.base <span style=color:#f92672>import</span> BaseCommand
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>class</span> <span style=color:#a6e22e>Command</span>(BaseCommand):
</span></span><span style=display:flex><span>    <span style=color:#66d9ef>def</span> <span style=color:#a6e22e>add_arguments</span>(self, parser):
</span></span><span style=display:flex><span>        parser<span style=color:#f92672>.</span>add_argument(<span style=color:#e6db74>&#39;-s&#39;</span>, <span style=color:#e6db74>&#34;--start&#34;</span>, required<span style=color:#f92672>=</span><span style=color:#66d9ef>True</span>)
</span></span><span style=display:flex><span>        parser<span style=color:#f92672>.</span>add_argument(<span style=color:#e6db74>&#39;-e&#39;</span>, <span style=color:#e6db74>&#34;--end&#34;</span>, required<span style=color:#f92672>=</span><span style=color:#66d9ef>True</span>)
</span></span><span style=display:flex><span>  
</span></span><span style=display:flex><span>    <span style=color:#66d9ef>def</span> <span style=color:#a6e22e>handle</span>(self, <span style=color:#f92672>**</span>options):
</span></span><span style=display:flex><span>        <span style=color:#66d9ef>try</span>:
</span></span><span style=display:flex><span>            start_timed <span style=color:#f92672>=</span> datetime<span style=color:#f92672>.</span>datetime<span style=color:#f92672>.</span>strptime(options<span style=color:#f92672>.</span>get(<span style=color:#e6db74>&#39;start&#39;</span>, <span style=color:#66d9ef>None</span>), <span style=color:#e6db74>&#34;%Y-%m-</span><span style=color:#e6db74>%d</span><span style=color:#e6db74>&#34;</span>)
</span></span><span style=display:flex><span>            end_timed <span style=color:#f92672>=</span> datetime<span style=color:#f92672>.</span>datetime<span style=color:#f92672>.</span>strptime(options<span style=color:#f92672>.</span>get(<span style=color:#e6db74>&#39;end&#39;</span>, <span style=color:#66d9ef>None</span>), <span style=color:#e6db74>&#34;%Y-%m-</span><span style=color:#e6db74>%d</span><span style=color:#e6db74>&#34;</span>)
</span></span><span style=display:flex><span>            run(start_timed, end_timed)
</span></span><span style=display:flex><span>        <span style=color:#66d9ef>except</span> <span style=color:#a6e22e>Exception</span>:
</span></span><span style=display:flex><span>            print(traceback<span style=color:#f92672>.</span>print_exc())
</span></span></code></pre></div><p>如此就可以使用如下命令执行:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>python manage.py <span style=color:#f92672>{</span>pyfilename<span style=color:#f92672>}</span> --start 2023-04-01 --end 2023-05-01
</span></span></code></pre></div><h2 id=利用nginxfd反向代理解决跨域问题>利用nginxfd反向代理解决跨域问题
<a class=anchor href=#%e5%88%a9%e7%94%a8nginxfd%e5%8f%8d%e5%90%91%e4%bb%a3%e7%90%86%e8%a7%a3%e5%86%b3%e8%b7%a8%e5%9f%9f%e9%97%ae%e9%a2%98>#</a></h2><p>纠结了很久的跨域问题。。。。。。一直配置Django。。。。。问题重重，从配置方面这条路还没找到解决方案，如以后确认无误后就再放在这儿。告慰前面付出的种种艰辛 😓😀</p><p>来自(这儿)[https://www.jb51.net/article/105786.htm]</p><p>方法是： 打开<code>nginx</code>默认配置文件<code>/etc/nginx/sites-available/default</code>
更改如下：</p><pre tabindex=0><code>## demo listen 5017 proxy 5000 and 5001 ##
server {
 listen 5017; 
 server_name a.xxx.com;
 access_log /var/log/nginx/a.access.log;
 error_log /var/log/nginx/a.error.log;
 root html;
 index index.html index.htm index.php;
 ## send request back to flask ##
 location / {
  proxy_pass http://127.0.0.1:5000/ ; 
 #Proxy Settings
  proxy_redirect off;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
  proxy_max_temp_file_size 0;
  proxy_connect_timeout 90;
  proxy_send_timeout 90;
  proxy_read_timeout 90;
  proxy_buffer_size 4k;
  proxy_buffers 4 32k;
  proxy_busy_buffers_size 64k;
 }
 location /proxy {
  rewrite ^.+proxy/?(.*)$ /$1 break;
  proxy_pass http://127.0.0.1:5001/ ; 
 #Proxy Settings
  proxy_redirect off;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
  proxy_max_temp_file_size 0;
  proxy_connect_timeout 90;
  proxy_send_timeout 90;
  proxy_read_timeout 90;
  proxy_buffer_size 4k;
  proxy_buffers 4 32k;
  proxy_busy_buffers_size 64k;
 }
}
## End a.xxx.com ##
</code></pre><p>很显然，这种解决方法仅仅适用于同服务器，架设两个网站。进行跨域访问。
所以这种东西……就很欠缺。 或者<code>nginx</code>也支持多服务器“并联”？</p><p>但这种解决方案依然不能解决两个“严格无关”的网站通信。</p><h5 id=摒弃java后的欢乐时光>摒弃<code>java</code>后的&rsquo;欢乐&rsquo;?时光?
<a class=anchor href=#%e6%91%92%e5%bc%83java%e5%90%8e%e7%9a%84%e6%ac%a2%e4%b9%90%e6%97%b6%e5%85%89>#</a></h5><h2 id=django-的前端相关>Django 的前端相关
<a class=anchor href=#django-%e7%9a%84%e5%89%8d%e7%ab%af%e7%9b%b8%e5%85%b3>#</a></h2><p>[^_^]虽然我前端不用这个吧，但就一记录。届时估计还是回来翻Django官方文档的。
摘一个看一个牛逼哄哄的东西：
Removing hardcoded URLs in templates
Remember, when we wrote the link to a question in the polls/index.html template, the link was partially hardcoded like this</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-html data-lang=html><span style=display:flex><span>    &lt;<span style=color:#f92672>li</span>&gt;&lt;<span style=color:#f92672>a</span> <span style=color:#a6e22e>href</span><span style=color:#f92672>=</span><span style=color:#e6db74>&#34;/polls/{{ question.id }}/&#34;</span>&gt;{{ question.question_text }}&lt;/<span style=color:#f92672>a</span>&gt;&lt;/<span style=color:#f92672>li</span>&gt;
</span></span></code></pre></div><p>The problem with this hardcoded, tightly-coupled approach is that it becomes challenging to change URLs on projects with a lot of templates. However, since you defined the name argument in the path() functions in the polls.urls module, you can remove a reliance on specific URL paths defined in your url configurations by using the <code>\{\% url \%\}</code> template tag:
The problem with this hardcoded, tightly-coupled approach is that it becomes challenging to change URLs on projects with a lot of templates. However, since you defined the name argument in the path() functions in the polls.urls module, you can remove a reliance on specific URL paths defined in your url configurations by using the <code>\{\% url \%\}</code> template tag:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-html data-lang=html><span style=display:flex><span>    &lt;<span style=color:#f92672>li</span>&gt;&lt;<span style=color:#f92672>a</span> <span style=color:#a6e22e>href</span><span style=color:#f92672>=</span><span style=color:#e6db74>&#34;{% url &#39;detail&#39; question.id %}&#34;</span>&gt;{{ question.question_text }}&lt;/<span style=color:#f92672>a</span>&gt;&lt;/<span style=color:#f92672>li</span>&gt;
</span></span></code></pre></div><p>The way this works is by looking up the URL definition as specified in the polls.urls module. You can see exactly where the URL name of ‘detail’ is defined below:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-html data-lang=html><span style=display:flex><span>    # the &#39;name&#39; value as called by the {% url %} template tag
</span></span><span style=display:flex><span>    path(&#39;&lt;<span style=color:#f92672>int:question_id</span>&gt;/&#39;, views.detail, name=&#39;detail&#39;),
</span></span></code></pre></div><p>If you want to change the URL of the polls detail view to something else, perhaps to something like polls/specifics/12/ instead of doing it in the template (or templates) you would change it in polls/urls.py:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-html data-lang=html><span style=display:flex><span>    # added the word &#39;specifics&#39;
</span></span><span style=display:flex><span>    path(&#39;specifics/&lt;<span style=color:#f92672>int:question_id</span>&gt;/&#39;, views.detail, name=&#39;detail&#39;),
</span></span></code></pre></div><h5 id=namespacing-url-names>Namespacing URL names
<a class=anchor href=#namespacing-url-names>#</a></h5><p>The answer is to add namespaces to your URLconf. In the polls/urls.py file, go ahead and add an app_name to set the application namespace:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-html data-lang=html><span style=display:flex><span>    from django.urls import path
</span></span><span style=display:flex><span>    
</span></span><span style=display:flex><span>    from . import views
</span></span><span style=display:flex><span>    
</span></span><span style=display:flex><span>    app_name = &#39;polls&#39;
</span></span><span style=display:flex><span>    urlpatterns = [
</span></span><span style=display:flex><span>        path(&#39;&#39;, views.index, name=&#39;index&#39;),
</span></span><span style=display:flex><span>        path(&#39;&lt;<span style=color:#f92672>int:question_id</span>&gt;/&#39;, views.detail, name=&#39;detail&#39;),
</span></span><span style=display:flex><span>        path(&#39;&lt;<span style=color:#f92672>int:question_id</span>&gt;/results/&#39;, views.results, name=&#39;results&#39;),
</span></span><span style=display:flex><span>        path(&#39;&lt;<span style=color:#f92672>int:question_id</span>&gt;/vote/&#39;, views.vote, name=&#39;vote&#39;),
</span></span><span style=display:flex><span>    ]
</span></span></code></pre></div><p>Change your polls/index.html template from:
polls/templates/polls/index.html¶</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-html data-lang=html><span style=display:flex><span>    &lt;<span style=color:#f92672>li</span>&gt;&lt;<span style=color:#f92672>a</span> <span style=color:#a6e22e>href</span><span style=color:#f92672>=</span><span style=color:#e6db74>&#34;{% url &#39;detail&#39; question.id %}&#34;</span>&gt;{{ question.question_text }}&lt;/<span style=color:#f92672>a</span>&gt;&lt;/<span style=color:#f92672>li</span>&gt;
</span></span></code></pre></div><p>to point at the namespaced detail view:
polls/templates/polls/index.html¶</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-html data-lang=html><span style=display:flex><span>    &lt;<span style=color:#f92672>li</span>&gt;&lt;<span style=color:#f92672>a</span> <span style=color:#a6e22e>href</span><span style=color:#f92672>=</span><span style=color:#e6db74>&#34;{% url &#39;polls:detail&#39; question.id %}&#34;</span>&gt;{{ question.question_text }}&lt;/<span style=color:#f92672>a</span>&gt;&lt;/<span style=color:#f92672>li</span>&gt;
</span></span></code></pre></div><h3 id=版本>版本
<a class=anchor href=#%e7%89%88%e6%9c%ac>#</a></h3><p>其中，很令人头疼的便是版本。 如果遇到什么莫名其妙的错，请查看是否是版本的原因。
这里的版本原因并不☞一些人说的库依赖严重，好像开发者版本更迭不考虑兼容——或者说居然勤奋的接口重换那般严重。
此处仅仅☞在运行新版本时否个方法时，或许会莫名其妙引发一个早已摒弃的函数错误。这时候就可能是在折腾版本是导致有的不同版本有文件残留。在运行时莫名其妙的被<code>import</code>了然后它有调取其他东西，但是找不到的…</p><p>这时候轻则<code>pip uninstall</code> 重则环境重建。所以可见虚拟环境还是挺有用的嘛——</p><h3 id=mvc>MVC
<a class=anchor href=#mvc>#</a></h3><p>全名： <code>Model</code> 、<code>View</code>、<code>Controller</code>。模型，视图，控制器这种功能分离的软件设计规范。所以它是通用的…不要和爪哇捆绑，搞得和某个神奇技术一般… (⊙﹏⊙)</p><hr><h2 id=简介>简介
<a class=anchor href=#%e7%ae%80%e4%bb%8b>#</a></h2><p>在安装之后，使用<code>django-admin startproject </code>+名字来初始化一个工程。 对比到<code>python</code>中就是创建好了文档目录，还在文件中写入相关框架代码，以此支持运行。</p><h3 id=试一下>试一下?
<a class=anchor href=#%e8%af%95%e4%b8%80%e4%b8%8b>#</a></h3><p><code>python manage.py runserver</code>
便可开启服务器，这时候访问相应端口，就一个欢迎界面，提示嗯~ o(<em>￣▽￣</em>)o，你能开跑了。</p><h4 id=再试一下>再试一下？
<a class=anchor href=#%e5%86%8d%e8%af%95%e4%b8%80%e4%b8%8b>#</a></h4><p>在11版本中有<code>\admin</code>地址可以访问，访问之后便是一个登陆界面.但,并不知道用户名和密码啊~ emm… 不过好处是能看到这个页面至少保证了<code>django</code>在<code>render</code>一个<code>.html</code>页面时是正常的。而之前说的老版本残留就会导致<code>render</code>时出错。</p><h3 id=结构>结构
<a class=anchor href=#%e7%bb%93%e6%9e%84>#</a></h3><p>根目录下，&lsquo;项目名文件&rsquo;是项目容器😰
<code>manage.py</code> 命令行工具，emm 类似于<code>python click库</code>的命令行程序，使用参数干不同的事情。
进入到项目容器中，其中<code>settings.py</code>顾名思义
<code>urls.py</code>同上，管理各个<code>url</code>通往哪里
<code>wsgl.py</code>某个兼容啥，现在不用管…</p><h3 id=得知结构之后>得知结构之后
<a class=anchor href=#%e5%be%97%e7%9f%a5%e7%bb%93%e6%9e%84%e4%b9%8b%e5%90%8e>#</a></h3><p>然后就能</p><ol><li><p>在<code>urls.py</code>里愉快的添加各个功能url。这里面就一个urlpatterns列表，使用<code>djangol.conf.urls.url</code>方法来配置。
不过其对应的执行函数都需要一个<code>request</code>来接受请求数据。 <code>return</code>回一个页面~ 现在用到的有<code>django,shortcuts.render 及 render_to_response</code>出来的，以及<code>django.http.HttpResponse</code>出来的东西。</p></li><li><p>嗯…… <code>ulr</code> 链接的执行方法详情就放在新创建的<code>view.py</code>中管理。</p></li><li><p>而在<code>view</code>中需要渲染的html文件则放置在根目录新创建的<code>templates</code>文件夹中。通过在<code>setting.py</code>中的&rsquo;TEMPLATES&rsquo;列表中的不知名字典(因为它确实没取名啊😔)de<code>DIRS</code>元素来指路。</p></li></ol><h3 id=这下可以很厉害了>这下可以很厉害了
<a class=anchor href=#%e8%bf%99%e4%b8%8b%e5%8f%af%e4%bb%a5%e5%be%88%e5%8e%89%e5%ae%b3%e4%ba%86>#</a></h3><p>进而进行数据库配置—— 还在<code>setting.py</code>中的&rsquo;DATABASES&rsquo;来指路。
但Django规定要使用模型，就要创建一个爱怕怕<code>app</code>：</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span>django-admin startapp TestModel 🦑
</span></span></code></pre></div><p>再将此爱怕怕领到<code>setting.py</code>中<code>NSTALLED_APPS</code>中签一下到。
随后在<code>TestModel</code>下的<code>models</code>中创建继承于<code>django.db.models.Model</code>的数据类，然后使用隶属于<code>models</code>下的方法来制定数据类型eg:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span>name <span style=color:#f92672>=</span> models<span style=color:#f92672>.</span>CharField(max_length<span style=color:#f92672>=</span><span style=color:#ae81ff>20</span>)
</span></span></code></pre></div><blockquote><p>毕竟不能直接通过Python的自由类嘛… 然后也肯定不能通过python的制定类型… 毕竟python数据类型和MySQL天差地别。</p></blockquote><p>最后
再回到命令行中使用</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span>python manage.py migrate        //创建表结构
</span></span><span style=display:flex><span>python manage.py makemigrations //通知更改
</span></span><span style=display:flex><span>python manage.py testModel      // 创建表结构 😲❓
</span></span><span style=display:flex><span>正式拉入编制之后就能用了。
</span></span></code></pre></div><p>2019年1月23日</p><pre tabindex=0><code>- Change your models(in *models.py*)
- Run *python manage.py makemigrations* to create migration for those changes
- Run *python manage.py migrate* to apply those changes to the database
</code></pre><p>Of courses, If Null Run <em>python manage.py migrate</em> can make a models.py whitch has nothings.</p><h4 id=那么这个数据库怎么操作呢>那么这个数据库怎么操作呢？
<a class=anchor href=#%e9%82%a3%e4%b9%88%e8%bf%99%e4%b8%aa%e6%95%b0%e6%8d%ae%e5%ba%93%e6%80%8e%e4%b9%88%e6%93%8d%e4%bd%9c%e5%91%a2>#</a></h4><p>自然是到<code>urls.py</code>中添加🔗链接到方法的路
再到容器里面添加t<code>estdb.py</code>来说明方法详细。</p><h5 id=增删改查>增删改查
<a class=anchor href=#%e5%a2%9e%e5%88%a0%e6%94%b9%e6%9f%a5>#</a></h5><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span>实例化类
</span></span><span style=display:flex><span>直接<span style=color:#f92672>.</span>save()即保存
</span></span><span style=display:flex><span>未实例化类<span style=color:#960050;background-color:#1e0010>，</span>all标识查找全部
</span></span><span style=display:flex><span><span style=color:#f92672>.</span>objects<span style=color:#f92672>.</span>filter(填写删选条件)
</span></span><span style=display:flex><span><span style=color:#f92672>.</span>objects<span style=color:#f92672>.</span>get(获取)
</span></span><span style=display:flex><span><span style=color:#f92672>.</span>order_by(排序条件)
</span></span><span style=display:flex><span>更改则是将查出来的东西直接修改<span style=color:#f92672>.</span>update(修改东西)
</span></span><span style=display:flex><span>再<span style=color:#f92672>.</span>save保存
</span></span><span style=display:flex><span>删除便是<span style=color:#f92672>.</span>delete()
</span></span><span style=display:flex><span><span style=color:#960050;background-color:#1e0010>``</span><span style=color:#f92672>.</span>
</span></span><span style=display:flex><span>差不多了  之后的详细再随情况更新<span style=color:#960050;background-color:#1e0010>。</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#75715e>### 那么数据库表多了怎么一键生成对应类呢？</span>
</span></span><span style=display:flex><span><span style=color:#960050;background-color:#1e0010>```</span>shell
</span></span><span style=display:flex><span>python manage<span style=color:#f92672>.</span>py inspectdb  <span style=color:#f92672>//</span>自动生成models模型文件
</span></span><span style=display:flex><span>python manage<span style=color:#f92672>.</span>py inspectdb <span style=color:#f92672>&gt;</span> app<span style=color:#f92672>/</span>models<span style=color:#f92672>.</span>py      <span style=color:#f92672>//</span>假设有了名为<span style=color:#e6db74>&#39;app&#39;</span>的爱怕怕
</span></span><span style=display:flex><span><span style=color:#f92672>//</span> 老一套
</span></span><span style=display:flex><span>python manage<span style=color:#f92672>.</span>py makemigrations
</span></span><span style=display:flex><span>python manage<span style=color:#f92672>.</span>py migrate
</span></span></code></pre></div><p>但是会将之前<code>models.py</code>中的东西删掉… 还会把数据库中的表名重命名… 按它的规矩来生成，嗯…其实也🆗的。</p><h2 id=我爱java-2018年6月24日16点40分的我由衷的写到>我爱Java 2018年6月24日16点40分的我由衷的写到
<a class=anchor href=#%e6%88%91%e7%88%b1java-2018%e5%b9%b46%e6%9c%8824%e6%97%a516%e7%82%b940%e5%88%86%e7%9a%84%e6%88%91%e7%94%b1%e8%a1%b7%e7%9a%84%e5%86%99%e5%88%b0>#</a></h2><p>在<code>MySQL</code>中读取<code>blob</code>存储的字段时，使用<code>BinaryField</code>不可使用其逆向生成的模型读取方式。当然，对照表如下</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-md data-lang=md><span style=display:flex><span>            &#39;AutoField&#39;: &#39;integer AUTO_INCREMENT&#39;,
</span></span><span style=display:flex><span>            &#39;BigAutoField&#39;: &#39;bigint AUTO_INCREMENT&#39;,
</span></span><span style=display:flex><span>            &#39;BinaryField&#39;: &#39;longblob&#39;,
</span></span><span style=display:flex><span>            &#39;BooleanField&#39;: &#39;bool&#39;,
</span></span><span style=display:flex><span>            &#39;CharField&#39;: &#39;varchar(%(max_length)s)&#39;,
</span></span><span style=display:flex><span>            &#39;CommaSeparatedIntegerField&#39;: &#39;varchar(%(max_length)s)&#39;,
</span></span><span style=display:flex><span>            &#39;DateField&#39;: &#39;date&#39;,
</span></span><span style=display:flex><span>            &#39;DateTimeField&#39;: &#39;datetime&#39;,
</span></span><span style=display:flex><span>            &#39;DecimalField&#39;: &#39;numeric(%(max_digits)s, %(decimal_places)s)&#39;,
</span></span><span style=display:flex><span>            &#39;DurationField&#39;: &#39;bigint&#39;,
</span></span><span style=display:flex><span>            &#39;FileField&#39;: &#39;varchar(%(max_length)s)&#39;,
</span></span><span style=display:flex><span>            &#39;FilePathField&#39;: &#39;varchar(%(max_length)s)&#39;,
</span></span><span style=display:flex><span>            &#39;FloatField&#39;: &#39;double precision&#39;,
</span></span><span style=display:flex><span>            &#39;IntegerField&#39;: &#39;integer&#39;,
</span></span><span style=display:flex><span>            &#39;BigIntegerField&#39;: &#39;bigint&#39;,
</span></span><span style=display:flex><span>            &#39;IPAddressField&#39;: &#39;char(15)&#39;,
</span></span><span style=display:flex><span>            &#39;GenericIPAddressField&#39;: &#39;char(39)&#39;,
</span></span><span style=display:flex><span>            &#39;NullBooleanField&#39;: &#39;bool&#39;,
</span></span><span style=display:flex><span>            &#39;OneToOneField&#39;: &#39;integer&#39;,
</span></span><span style=display:flex><span>            &#39;PositiveIntegerField&#39;: &#39;integer UNSIGNED&#39;,
</span></span><span style=display:flex><span>            &#39;PositiveSmallIntegerField&#39;: &#39;smallint UNSIGNED&#39;,
</span></span><span style=display:flex><span>            &#39;SlugField&#39;: &#39;varchar(%(max_length)s)&#39;,
</span></span><span style=display:flex><span>            &#39;SmallIntegerField&#39;: &#39;smallint&#39;,
</span></span><span style=display:flex><span>            &#39;TextField&#39;: &#39;longtext&#39;,
</span></span><span style=display:flex><span>            &#39;TimeField&#39;: &#39;time&#39;,
</span></span><span style=display:flex><span>            &#39;UUIDField&#39;: &#39;char(32)&#39;,
</span></span></code></pre></div><p>以上是一部分，具体点<a href=https://www.cnblogs.com/sun1994/p/8566988.html>这里</a></p><h5 id=模型字段名称>模型字段名称
<a class=anchor href=#%e6%a8%a1%e5%9e%8b%e5%ad%97%e6%ae%b5%e5%90%8d%e7%a7%b0>#</a></h5><p>在逆向生成时，我遇到过一次将数据库名修改的先例，不过后来似乎没有修改过。 然后就是驼峰命名法的字段可能emm也是因为此我才开始写这些信息，就是，驼峰命名法的字段可能在模型字段中为全小写。 还有就是<code>Django</code>莫名其妙的的编码错误，真的是一分钟编程，一小时修改编码…而且调试起来真的…我目前的调试方式极为原始，所以感觉真的<code>不想编程</code>嗯…</p><h4 id=django-返回文件下载>Django 返回文件下载
<a class=anchor href=#django-%e8%bf%94%e5%9b%9e%e6%96%87%e4%bb%b6%e4%b8%8b%e8%bd%bd>#</a></h4><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-py data-lang=py><span style=display:flex><span>    <span style=color:#66d9ef>def</span> <span style=color:#a6e22e>readFile</span>(fn, buf_size<span style=color:#f92672>=</span><span style=color:#ae81ff>262144</span>):  <span style=color:#75715e># 大文件下载，设定缓存大小</span>
</span></span><span style=display:flex><span>        f <span style=color:#f92672>=</span> open(fn, <span style=color:#e6db74>&#34;rb&#34;</span>)
</span></span><span style=display:flex><span>        <span style=color:#66d9ef>while</span> <span style=color:#66d9ef>True</span>:  <span style=color:#75715e># 循环读取</span>
</span></span><span style=display:flex><span>            c <span style=color:#f92672>=</span> f<span style=color:#f92672>.</span>read(buf_size)
</span></span><span style=display:flex><span>            <span style=color:#66d9ef>if</span> c:
</span></span><span style=display:flex><span>                <span style=color:#66d9ef>yield</span> c
</span></span><span style=display:flex><span>            <span style=color:#66d9ef>else</span>:
</span></span><span style=display:flex><span>                <span style=color:#66d9ef>break</span>
</span></span><span style=display:flex><span>        f<span style=color:#f92672>.</span>close()
</span></span><span style=display:flex><span>    response <span style=color:#f92672>=</span> HttpResponse(readFile(filePath), content_type<span style=color:#f92672>=</span><span style=color:#e6db74>&#39;APPLICATION/OCTET-STREAM&#39;</span>)  <span style=color:#75715e># 设定文件头，这种设定可以让任意文件都能正确下载，而且已知文本文件不是本地打开</span>
</span></span><span style=display:flex><span>    fileName <span style=color:#f92672>=</span> <span style=color:#e6db74>&#39;haya&#39;</span>
</span></span><span style=display:flex><span>    fileType <span style=color:#f92672>=</span> <span style=color:#e6db74>&#39;.docx&#39;</span>
</span></span><span style=display:flex><span>    response[<span style=color:#e6db74>&#39;Content-Disposition&#39;</span>] <span style=color:#f92672>=</span> <span style=color:#e6db74>&#39;attachment; filename=&#39;</span> <span style=color:#f92672>+</span> fileName<span style=color:#f92672>.</span>encode(<span style=color:#e6db74>&#39;utf-8&#39;</span>) <span style=color:#f92672>+</span> fileType<span style=color:#f92672>.</span>encode(<span style=color:#e6db74>&#39;utf-8&#39;</span>)  <span style=color:#75715e># 设定传输给客户端的文件名称</span>
</span></span><span style=display:flex><span>    response[<span style=color:#e6db74>&#39;Content-Length&#39;</span>] <span style=color:#f92672>=</span> os<span style=color:#f92672>.</span>path<span style=color:#f92672>.</span>getsize(filePath)  <span style=color:#75715e># 传输给客户端的文件大小</span>
</span></span><span style=display:flex><span>    <span style=color:#66d9ef>return</span> response 
</span></span></code></pre></div><h4 id=python-docx编辑>Python Docx编辑
<a class=anchor href=#python-docx%e7%bc%96%e8%be%91>#</a></h4><h5 id=替换>替换
<a class=anchor href=#%e6%9b%bf%e6%8d%a2>#</a></h5><pre tabindex=0><code class=language-docx data-lang=docx>    在`.docx`文件中将需要替换的位置 使用变量站位，写法{{ placheholdParaName }}
</code></pre><p>使用文件时，只能写做<code>{{placheholdParaName}}</code>不能有空格…另外<code>docx</code>使用<code>docx</code>中的<code>Document</code>读入即可</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-py data-lang=py><span style=display:flex><span>    tpl <span style=color:#f92672>=</span> DocxTemplate(self<span style=color:#f92672>.</span>prjRootPath <span style=color:#f92672>+</span> <span style=color:#e6db74>&#39;/word_template/&#39;</span> <span style=color:#f92672>+</span> <span style=color:#e6db74>&#34;word_template.docx&#34;</span>)
</span></span><span style=display:flex><span>    sub1 <span style=color:#f92672>=</span> tpl<span style=color:#f92672>.</span>new_subdoc()
</span></span><span style=display:flex><span>    sub1<span style=color:#f92672>.</span>subdocx <span style=color:#f92672>=</span> Document(temPath <span style=color:#f92672>+</span> <span style=color:#e6db74>&#39;sub1_bond.docx&#39;</span>)
</span></span><span style=display:flex><span>    subContext[<span style=color:#e6db74>&#39;sub1&#39;</span>] <span style=color:#f92672>=</span> sub1
</span></span></code></pre></div><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-md data-lang=md><span style=display:flex><span>    上述中，只能写作……难道是因为使用{{someThing}}这种写法而隐藏了？！！
</span></span><span style=display:flex><span>    那么，今后写彩带注释岂不是不需要使用^_^而直接使用双花括号的写法就能直接隐藏了么(⊙o⊙ ) 　凄い
</span></span></code></pre></div><p><strong>Py中</strong>：</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-py data-lang=py><span style=display:flex><span>    <span style=color:#f92672>from</span> docxtpl <span style=color:#f92672>import</span> DocxTemplate, InlineImage
</span></span><span style=display:flex><span>    <span style=color:#f92672>from</span> docx.shared <span style=color:#f92672>import</span> Mm, Inches, Pt
</span></span><span style=display:flex><span>    doc <span style=color:#f92672>=</span> DocxTemplate(<span style=color:#e6db74>&#34;my_word_template.docx&#34;</span>)
</span></span><span style=display:flex><span>    myimage <span style=color:#f92672>=</span> InlineImage(doc,
</span></span><span style=display:flex><span>    <span style=color:#e6db74>&#39;C:/Users/GuPengxiang/Pictures/ha.jpg&#39;</span>,width<span style=color:#f92672>=</span>Mm(<span style=color:#ae81ff>20</span>))
</span></span><span style=display:flex><span>    context <span style=color:#f92672>=</span> { <span style=color:#e6db74>&#39;fundName&#39;</span> : <span style=color:#e6db74>u</span><span style=color:#e6db74>&#39;这里是基金名称&#39;</span>, <span style=color:#e6db74>&#39;stars&#39;</span>:<span style=color:#e6db74>u</span><span style=color:#e6db74>&#39;五星级琉璃六&#39;</span>, <span style=color:#e6db74>&#39;</span>
</span></span><span style=display:flex><span>    bench<span style=color:#e6db74>&#39;: u&#39;</span>对比基金<span style=color:#e6db74>&#39;, &#39;</span>income<span style=color:#e6db74>&#39;: u&#39;</span><span style=color:#ae81ff>12</span><span style=color:#e6db74>&#39;, &#39;</span>bb<span style=color:#e6db74>&#39;: u&#39;</span><span style=color:#ae81ff>0.1</span><span style=color:#f92672>%</span><span style=color:#e6db74>&#39;, &#39;</span>image0<span style=color:#e6db74>&#39; : myimage}</span>
</span></span><span style=display:flex><span>    doc<span style=color:#f92672>.</span>render(context)
</span></span><span style=display:flex><span>    doc<span style=color:#f92672>.</span>save(<span style=color:#e6db74>&#34;generated_doc.docx&#34;</span>)
</span></span></code></pre></div><h4 id=生成echarts图表图片>生成echarts图表图片
<a class=anchor href=#%e7%94%9f%e6%88%90echarts%e5%9b%be%e8%a1%a8%e5%9b%be%e7%89%87>#</a></h4><h5 id=环境>环境
<a class=anchor href=#%e7%8e%af%e5%a2%83>#</a></h5><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#75715e># 更新软件列表 &amp; 更新软件</span>
</span></span><span style=display:flex><span>sudo apt-get update    
</span></span><span style=display:flex><span>sudo apt-get upgrade
</span></span><span style=display:flex><span><span style=color:#75715e># 下载包</span>
</span></span><span style=display:flex><span>pip install pyecharts-snapshot
</span></span><span style=display:flex><span>wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.5.0-beta-linux-ubuntu-xenial-x86_64.tar.gz
</span></span><span style=display:flex><span><span style=color:#75715e># 解压</span>
</span></span><span style=display:flex><span>tar -xzvf phantomjs-2.5.0-beta-linux-ubuntu-xenial-x86_64.tar.gz
</span></span><span style=display:flex><span><span style=color:#75715e># 进入路径</span>
</span></span><span style=display:flex><span>cd phantomjs-2.5.0-beta-ubuntu-xenial/bin
</span></span><span style=display:flex><span><span style=color:#75715e># 赋予权限</span>
</span></span><span style=display:flex><span>chmod +x phantomjs
</span></span><span style=display:flex><span><span style=color:#75715e># 查看版本号</span>
</span></span><span style=display:flex><span>phantomjs -v  
</span></span><span style=display:flex><span><span style=color:#75715e># 若显示版本号，如 2.1.1 则生效</span>
</span></span></code></pre></div><h5 id=生成图片>生成图片
<a class=anchor href=#%e7%94%9f%e6%88%90%e5%9b%be%e7%89%87>#</a></h5><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-py data-lang=py><span style=display:flex><span><span style=color:#f92672>from</span> pyecharts <span style=color:#f92672>import</span> Line, Pie, Grid
</span></span><span style=display:flex><span><span style=color:#f92672>from</span> pyecharts_snapshot.main <span style=color:#f92672>import</span> make_a_snapshot
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>attr <span style=color:#f92672>=</span> [<span style=color:#e6db74>&#34;衬衫&#34;</span>, <span style=color:#e6db74>&#34;羊毛衫&#34;</span>, <span style=color:#e6db74>&#34;雪纺衫&#34;</span>, <span style=color:#e6db74>&#34;裤子&#34;</span>, <span style=color:#e6db74>&#34;高跟鞋&#34;</span>, <span style=color:#e6db74>&#34;袜子&#34;</span>]
</span></span><span style=display:flex><span>v1 <span style=color:#f92672>=</span> [<span style=color:#ae81ff>5</span>, <span style=color:#ae81ff>20</span>, <span style=color:#ae81ff>36</span>, <span style=color:#ae81ff>10</span>, <span style=color:#ae81ff>10</span>, <span style=color:#ae81ff>100</span>]
</span></span><span style=display:flex><span>v2 <span style=color:#f92672>=</span> [<span style=color:#ae81ff>55</span>, <span style=color:#ae81ff>60</span>, <span style=color:#ae81ff>16</span>, <span style=color:#ae81ff>20</span>, <span style=color:#ae81ff>15</span>, <span style=color:#ae81ff>80</span>]
</span></span><span style=display:flex><span>line <span style=color:#f92672>=</span> Line(<span style=color:#e6db74>&#34;折线图示例&#34;</span>)
</span></span><span style=display:flex><span>line<span style=color:#f92672>.</span>add(<span style=color:#e6db74>&#34;商家A&#34;</span>, attr, v1, mark_point<span style=color:#f92672>=</span>[<span style=color:#e6db74>&#34;average&#34;</span>])
</span></span><span style=display:flex><span>line<span style=color:#f92672>.</span>add(<span style=color:#e6db74>&#34;商家B&#34;</span>, attr, v2, is_smooth<span style=color:#f92672>=</span><span style=color:#66d9ef>True</span>, mark_line<span style=color:#f92672>=</span>[<span style=color:#e6db74>&#34;max&#34;</span>, <span style=color:#e6db74>&#34;average&#34;</span>])
</span></span><span style=display:flex><span>line<span style=color:#f92672>.</span>render(<span style=color:#e6db74>&#39;test.html&#39;</span>)
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>make_a_snapshot(<span style=color:#e6db74>&#39;test.html&#39;</span>, <span style=color:#e6db74>&#39;test.pdf&#39;</span>)
</span></span><span style=display:flex><span><span style=color:#75715e># 或者直接生成</span>
</span></span><span style=display:flex><span>line<span style=color:#f92672>.</span>render(<span style=color:#e6db74>&#39;test.png&#39;</span>)
</span></span></code></pre></div><p>在生成图片时，插件包文件源码中有Log，但却是print出来的，而在部署环境中不允许出现print，所以…… 得在包源码中将之屏蔽</p><h5 id=连续生成图片>连续生成图片
<a class=anchor href=#%e8%bf%9e%e7%bb%ad%e7%94%9f%e6%88%90%e5%9b%be%e7%89%87>#</a></h5><p>用以上方法来生成图片是…很慢的🐢⬅这个速度。但可以通过使用为渲染创建一个默认配置环境来避免多次生成环境配置。所以—— 具体来看<code>pyecharts</code>中的<a href=http://pyecharts.org/#/zh-cn/prepare>高级说明</a>🕶</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-py data-lang=py><span style=display:flex><span>    <span style=color:#f92672>from</span> pyecharts <span style=color:#f92672>import</span> Bar, Line
</span></span><span style=display:flex><span>    <span style=color:#f92672>from</span> pyecharts.engine <span style=color:#f92672>import</span> create_default_environment
</span></span><span style=display:flex><span>    
</span></span><span style=display:flex><span>    bar <span style=color:#f92672>=</span> Bar(<span style=color:#e6db74>&#34;我的第一个图表&#34;</span>, <span style=color:#e6db74>&#34;这里是副标题&#34;</span>)
</span></span><span style=display:flex><span>    bar<span style=color:#f92672>.</span>add(<span style=color:#e6db74>&#34;服装&#34;</span>, [<span style=color:#e6db74>&#34;衬衫&#34;</span>, <span style=color:#e6db74>&#34;羊毛衫&#34;</span>, <span style=color:#e6db74>&#34;雪纺衫&#34;</span>, <span style=color:#e6db74>&#34;裤子&#34;</span>, <span style=color:#e6db74>&#34;高跟鞋&#34;</span>, <span style=color:#e6db74>&#34;袜子&#34;</span>], [<span style=color:#ae81ff>5</span>, <span style=color:#ae81ff>20</span>, <span style=color:#ae81ff>36</span>, <span style=color:#ae81ff>10</span>, <span style=color:#ae81ff>75</span>, <span style=color:#ae81ff>90</span>])
</span></span><span style=display:flex><span>    
</span></span><span style=display:flex><span>    line <span style=color:#f92672>=</span> Line(<span style=color:#e6db74>&#34;我的第一个图表&#34;</span>, <span style=color:#e6db74>&#34;这里是副标题&#34;</span>)
</span></span><span style=display:flex><span>    line<span style=color:#f92672>.</span>add(<span style=color:#e6db74>&#34;服装&#34;</span>, [<span style=color:#e6db74>&#34;衬衫&#34;</span>, <span style=color:#e6db74>&#34;羊毛衫&#34;</span>, <span style=color:#e6db74>&#34;雪纺衫&#34;</span>, <span style=color:#e6db74>&#34;裤子&#34;</span>, <span style=color:#e6db74>&#34;高跟鞋&#34;</span>, <span style=color:#e6db74>&#34;袜子&#34;</span>], [<span style=color:#ae81ff>5</span>, <span style=color:#ae81ff>20</span>, <span style=color:#ae81ff>36</span>, <span style=color:#ae81ff>10</span>, <span style=color:#ae81ff>75</span>, <span style=color:#ae81ff>90</span>])
</span></span><span style=display:flex><span>    
</span></span><span style=display:flex><span>    env <span style=color:#f92672>=</span> create_default_environment(<span style=color:#e6db74>&#34;html&#34;</span>)
</span></span><span style=display:flex><span>    <span style=color:#75715e># 为渲染创建一个默认配置环境</span>
</span></span><span style=display:flex><span>    <span style=color:#75715e># create_default_environment(filet_ype)</span>
</span></span><span style=display:flex><span>    <span style=color:#75715e># file_type: &#39;html&#39;, &#39;svg&#39;, &#39;png&#39;, &#39;jpeg&#39;, &#39;gif&#39; or &#39;pdf&#39;</span>
</span></span><span style=display:flex><span>    
</span></span><span style=display:flex><span>    env<span style=color:#f92672>.</span>render_chart_to_file(bar, path<span style=color:#f92672>=</span><span style=color:#e6db74>&#39;bar.html&#39;</span>)
</span></span><span style=display:flex><span>    env<span style=color:#f92672>.</span>render_chart_to_file(line, path<span style=color:#f92672>=</span><span style=color:#e6db74>&#39;line.html&#39;</span>)
</span></span></code></pre></div><p>(<em>￣▽￣</em>)o 如上</p><h3 id=注意>注意
<a class=anchor href=#%e6%b3%a8%e6%84%8f>#</a></h3><pre><code>在生成报表时， 由于采用的是浏览器截图的方式，在使用`phantomjs`时会自动判断图片是否加载完成（echarts在显示图表之前是有一段动画的……）然后再`pyecharts`中并没有关闭动画的接口，而echarts是有的。 但毕竟`echarts`是在做翻译，所以只要在&quot;Chart&quot;基类中，将`animation=False`就可以了。 我改的时候在`chart.py`文件的29行，def __init__中。
</code></pre><h2 id=ssl加密https配置>SSl加密，https配置
<a class=anchor href=#ssl%e5%8a%a0%e5%af%86https%e9%85%8d%e7%bd%ae>#</a></h2><p>虽然就配置过之后显得操作很简单，而且也很明显，但就配置之初着实还是费了一些功夫的。或许是因为大而全的东西懒得看，而网上搜索到的粘贴复制之词又太过片面，或许大家写的时候也就当作日记来写的，本就没准备让别人去参考。所以再加上搜索的时候俺表述词不达意，所以总是很曲折（呵，用谷歌搜外文网就不存在这问题，前面就谦虚一下🙃）</p><h3 id=之前写的文档>之前写的文档
<a class=anchor href=#%e4%b9%8b%e5%89%8d%e5%86%99%e7%9a%84%e6%96%87%e6%a1%a3>#</a></h3><p>1 ssl加密部署步骤说明文档
一．申请ssl证书
1.生成csr文件，可使用openssl工具生成
(1)例:<code>openssl genrsa -des3 -out server.key 1024</code> 生成服务器key文件;
(2)例:<code>openssl req -new -key server.key -out server.csr</code> 生成服务器证书请求CSR文件;
或使用CSR文件生成工具生成(例https://www.chinassl.net/ssltools/generator-csr.html，填写信息后点击生成CSR文件即可)
（CSR文件中包括组织部门、国家地区、算法、以及邮箱和域名等信息）
2.申请/购买HTTPS证书， 填写与上述相同的信息，验证类型选择DNS，CSR生成选择提供CSR(即提供第一步生成的CSR文件)（例：在阿里云或腾讯等地，本文档撰写时是通过https://freessl.org/ 免费申请而来（一年有效期，单域名，））
二、验证域名所属关系
1.到域名管理控制台中选择云解析DNS, 选择域名，添加“记录”，记录类型选择‘TXT’，主机记录及记录值填写证书申请方提供内容。
2.等待1分钟或10分钟后，等待生效
3.点击验证
三、证书下载
验证通过后，下载网站提供证书，含（CA证书、服务器证书、服务器私钥）
四、Apache2部署开启SSL加密
更改httpd.conf 文件设置：
1.Listen {内网IP}:80
2.开启models
(1)LoadModule ssl_module modules/mod_ssl.so
(2)LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
(3)LoadModule rewrite_module modules/mod_rewrite.so
(4)ServerName {与域名相同}（未测试是否必须相同）
3.http跳转到https:
(1)RewriteEngine on
(2)RewriteCond %{SERVER_PORT} !^443$
(3)RewriteRule ^/?(.*)$ https://%{SERVER_NAME}/$1 [L,R]
更改extra/httpd-ssl.conf 文件设置
1.Listen 443
2.ServerName <a href=https://www.lejinrong.cn>www.lejinrong.cn</a>
3.ServerAdmin admin@lejinrong
4.SSLCertificateFile &ldquo;c:/Apache24/conf/ssl/server.crt&rdquo;
5.SSLCertificateKeyFile &ldquo;c:/Apache24/conf/ssl/server.key&rdquo;
第四步中crt文件指向服务器证书文件， 第五步中.key文件指向私钥文件
(其余部署方案或许有所不同，会使用CA证书)</p><p>1.1 注意： 确保服务器中防火墙入站规则中添加了80端口和443端口。</p><p>2 附：
2.1.1 本地测试方案：</p><p>环境：wamp Apache 2.4.9
前言：wamp安装好后，默认的只有http服务，以下配置启用https服务
条件：在Apache安装目录下需要有一下文件
         [Apache安装目录]/modules/ mod_ssl.so
         [Apache安装目录]/bin/ openssl.exe, libeay32.dll, ssleay32.dll
         [Apache安装目录]/conf/ openssl.cnf
步骤：
一、修改配置文件httpd.conf，去掉下面行首的#（载入ssl模块和其他配置文件）
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf
二、认证文件生成（生成证书签发请求）
进入Apache安装目录的bin目录下，输入cmd，进入DOS窗口，输入以下命令
openssl req -new -out server.csr -config ../conf/openssl.cnf
回车后提示输入密码和确认密码，本机输入：keypasswd
后面会提示输入一系列的参数
&mldr;&mldr;
Country Name (2 letter code) [AU]: （要求输入国家缩写，只能输入2个字母，这里输入cn）
State or Province Name (full name) [Some-State]: （要求输入州名或省名，这里输入hubei）
Locality Name (eg, city) []: （要求输入城市名，这里输入wuhan）
Organization Name (eg, company) [Internet Widgits Pty Ltd]: （要求输入组织名或公司名，这里输入gg）
Organizational Unit Name (eg, section) []: （要求输入部门名，这里输入gg）
Common Name (eg, YOUR name) []: （要求输入服务器域名或IP地址）
Email Address []: （要求输入邮件地址）
A challenge password[]:（要求输入密码）
An optional company name[]（要求输入公司别名，这里输入ggs）
&mldr;..
生成私钥，在DOS窗口下的Apache的bin目录下输入命令
openssl rsa -in privkey.pem -out server.key
然后要求输入之前 privkey.pem 的密码（keypasswd)
创建证书，输入命令
openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 8000
回车后，显示创建成功，有效期为 8000 天
将Apache的bin目录下的server.csr、server.crt、server.key拷贝到Apache安装目录下的conf\ssl，若没有ssl文件则创建
打开Apache安装目录conf/extra/httpd-ssl.conf文件，设置SSLCertificateFile和SSLCertificateKeyFile
SSLCertificateFile &ldquo;C:/apache2.4.9/conf/ssl/server.crt&rdquo;
SSLCertificateKeyFile &ldquo;C:/apache2.4.9/conf/ssl/server.key&rdquo;
最后重启Apache服务，HTTPS服务的默认监听端口为443
 
随后在本机中安装<code>server.crt</code>至<code>收信人的根证书颁发机构</code>即可不再提示证书无效
注意：在重启Apache时，若Apache服务启动不起来，则在Apache安装目录的bin目录下，输入httpd –t，可以根据提示来修改你的配置文件</p><h3 id=附>附
<a class=anchor href=#%e9%99%84>#</a></h3><p>现在是2018年8月25日16点01分 所以上面其实是一个月前写给别人看的文档。
在我搜的时候由于先在本地配置，尔后再网上找CA发证书，自我感觉这个步骤没有什么问题。就今天在</p><h4 id=apache配置双网站https>Apache配置双网站/https
<a class=anchor href=#apache%e9%85%8d%e7%bd%ae%e5%8f%8c%e7%bd%91%e7%ab%99https>#</a></h4><p>的时候，也是这样，先在本地通过不同端口测试，确定方案之后再在服务器上通过<code>ServerName</code>进行区分。
也就是启用<code>httpd-vhosts.conf</code>之后，再</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-md data-lang=md><span style=display:flex><span># Virtual Hosts
</span></span><span style=display:flex><span>#
</span></span><span style=display:flex><span># Required modules: mod_log_config
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># If you want to maintain multiple domains/hostnames on your
</span></span><span style=display:flex><span># machine you can setup VirtualHost containers for them. Most configurations
</span></span><span style=display:flex><span># use only name-based virtual hosts so the server doesn&#39;t need to worry about
</span></span><span style=display:flex><span># IP addresses. This is indicated by the asterisks in the directives below.
</span></span><span style=display:flex><span>#
</span></span><span style=display:flex><span># Please see the documentation at 
</span></span><span style=display:flex><span># &lt;URL:http://httpd.apache.org/docs/2.4/vhosts/&gt;
</span></span><span style=display:flex><span># for further details before you try to setup virtual hosts.
</span></span><span style=display:flex><span>#
</span></span><span style=display:flex><span># You may use the command line option &#39;-S&#39; to verify your virtual host
</span></span><span style=display:flex><span># configuration.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#
</span></span><span style=display:flex><span># VirtualHost example:
</span></span><span style=display:flex><span># Almost any Apache directive may go into a VirtualHost container.
</span></span><span style=display:flex><span># The first VirtualHost section is used for all requests that do not
</span></span><span style=display:flex><span># match a ServerName or ServerAlias in any &lt;VirtualHost&gt; block.
</span></span><span style=display:flex><span>#
</span></span><span style=display:flex><span>&lt;VirtualHost 192.168.1.81:80&gt;
</span></span><span style=display:flex><span>    ServerName www.lejinrong.cn
</span></span><span style=display:flex><span>    ServerAlias www.lejinrong.cn
</span></span><span style=display:flex><span>    ServerAdmin www.lejinrong.cn
</span></span><span style=display:flex><span>    #指定myweb项目的wsgi.py配置文件路径  
</span></span><span style=display:flex><span>    WSGIScriptAlias / D:/FundEvaluationSystem_svn1/Fund_Evaluation_System_V2/Fund_Evaluation_System/wsgi.py
</span></span><span style=display:flex><span>    #配置静态变量路径
</span></span><span style=display:flex><span>    Alias /static/ D:/FundEvaluationSystem_svn1/Fund_Evaluation_System_V2/static/
</span></span><span style=display:flex><span>    &lt;<span style=color:#f92672>Directory</span> <span style=color:#a6e22e>D:</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>FundEvaluationSystem_svn1</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>Fund_Evaluation_System_V2</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>static</span>&gt;  
</span></span><span style=display:flex><span>        Allow from all
</span></span><span style=display:flex><span>    &lt;/<span style=color:#f92672>Directory</span>&gt;
</span></span><span style=display:flex><span>    DocumentRoot &#34;D:/FundEvaluationSystem_svn1/Fund_Evaluation_System_V2&#34;
</span></span><span style=display:flex><span>    &lt;<span style=color:#f92672>Directory</span> <span style=color:#960050;background-color:#1e0010>&#34;</span><span style=color:#a6e22e>D:</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>FundEvaluationSystem_svn1</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>Fund_Evaluation_System_V2</span><span style=color:#960050;background-color:#1e0010>&#34;</span>&gt;  
</span></span><span style=display:flex><span>        Options Indexes FollowSymLinks
</span></span><span style=display:flex><span>        AllowOverride None
</span></span><span style=display:flex><span>    &lt;/<span style=color:#f92672>Directory</span>&gt;
</span></span><span style=display:flex><span>    RewriteEngine on
</span></span><span style=display:flex><span>    RewriteCond %{SERVER_PORT} !^400$
</span></span><span style=display:flex><span>    RewriteRule ^/?(.*)$ https://%{SERVER_NAME}/$1 [L,R]
</span></span><span style=display:flex><span>    ErrorLog &#34;logs/dummy-host.example.com-error.log&#34;
</span></span><span style=display:flex><span>    CustomLog &#34;logs/dummy-host.example.com-access.log&#34; common
</span></span><span style=display:flex><span>&lt;/<span style=color:#f92672>VirtualHost</span>&gt;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>&lt;<span style=color:#f92672>VirtualHost</span> <span style=color:#a6e22e>192</span><span style=color:#960050;background-color:#1e0010>.</span><span style=color:#a6e22e>168</span><span style=color:#960050;background-color:#1e0010>.</span><span style=color:#a6e22e>1</span><span style=color:#960050;background-color:#1e0010>.</span><span style=color:#a6e22e>81:8880</span>&gt;
</span></span><span style=display:flex><span>    ServerName lejinrong.cn
</span></span><span style=display:flex><span>    ServerAlias vip.lejinrong.cn
</span></span><span style=display:flex><span>    ServerAdmin vip.lejinrong.cn
</span></span><span style=display:flex><span>    #指定myweb项目的wsgi.py配置文件路径  
</span></span><span style=display:flex><span>    WSGIScriptAlias / D:/FundEvaluationSystem_svn1/Fund_Evaluation_System_V3/Fund_Evaluation_System/wsgi.py
</span></span><span style=display:flex><span>    #配置静态变量路径
</span></span><span style=display:flex><span>    Alias /static/ D:/FundEvaluationSystem_svn1/Fund_Evaluation_System_V3/static/
</span></span><span style=display:flex><span>    &lt;<span style=color:#f92672>Directory</span> <span style=color:#a6e22e>D:</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>FundEvaluationSystem_svn1</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>Fund_Evaluation_System_V3</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>static</span>&gt;
</span></span><span style=display:flex><span>        Allow from all
</span></span><span style=display:flex><span>    &lt;/<span style=color:#f92672>Directory</span>&gt;
</span></span><span style=display:flex><span>    DocumentRoot &#34;D:/FundEvaluationSystem_svn1/Fund_Evaluation_System_V3&#34;
</span></span><span style=display:flex><span>    &lt;<span style=color:#f92672>Directory</span> <span style=color:#960050;background-color:#1e0010>&#34;</span><span style=color:#a6e22e>D:</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>FundEvaluationSystem_svn1</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>Fund_Evaluation_System_V3</span><span style=color:#960050;background-color:#1e0010>&#34;</span>&gt;  
</span></span><span style=display:flex><span>        Options Indexes FollowSymLinks
</span></span><span style=display:flex><span>        AllowOverride None
</span></span><span style=display:flex><span>    &lt;/<span style=color:#f92672>Directory</span>&gt;
</span></span><span style=display:flex><span>    ErrorLog &#34;logs/dummy-host.example.com-error.log&#34;
</span></span><span style=display:flex><span>    CustomLog &#34;logs/dummy-host.example.com-access.log&#34; common
</span></span><span style=display:flex><span>    RewriteEngine on
</span></span><span style=display:flex><span>    RewriteCond %{SERVER_PORT} !^443$
</span></span><span style=display:flex><span>    RewriteRule ^/?(.*)$ https://%{SERVER_NAME}/$1 [L,R]
</span></span><span style=display:flex><span>&lt;/<span style=color:#f92672>VirtualHost</span>&gt;
</span></span></code></pre></div><p>同理，在<code>httpd-ssl.conf</code>中也是通过配置不同<code>VirtualHost</code>进行区分</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-md data-lang=md><span style=display:flex><span>#
</span></span><span style=display:flex><span># This is the Apache server configuration file providing SSL support.
</span></span><span style=display:flex><span># It contains the configuration directives to instruct the server how to
</span></span><span style=display:flex><span># serve pages over an https connection. For detailed information about these 
</span></span><span style=display:flex><span># directives see &lt;URL:http://httpd.apache.org/docs/2.4/mod/mod_ssl.html&gt;
</span></span><span style=display:flex><span># 
</span></span><span style=display:flex><span># Do NOT simply read the instructions in here without understanding
</span></span><span style=display:flex><span># what they do.  They&#39;re here only as hints or reminders.  If you are unsure
</span></span><span style=display:flex><span># consult the online docs. You have been warned.  
</span></span><span style=display:flex><span>#
</span></span><span style=display:flex><span># Required modules: mod_log_config, mod_setenvif, mod_ssl,
</span></span><span style=display:flex><span>#          socache_shmcb_module (for default value of SSLSessionCache)
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#
</span></span><span style=display:flex><span># Pseudo Random Number Generator (PRNG):
</span></span><span style=display:flex><span># Configure one or more sources to seed the PRNG of the SSL library.
</span></span><span style=display:flex><span># The seed data should be of good random quality.
</span></span><span style=display:flex><span># WARNING! On some platforms /dev/random blocks if not enough entropy
</span></span><span style=display:flex><span># is available. This means you then cannot use the /dev/random device
</span></span><span style=display:flex><span># because it would lead to very long connection times (as long as
</span></span><span style=display:flex><span># it requires to make more entropy available). But usually those
</span></span><span style=display:flex><span># platforms additionally provide a /dev/urandom device which doesn&#39;t
</span></span><span style=display:flex><span># block. So, if available, use this one instead. Read the mod_ssl User
</span></span><span style=display:flex><span># Manual for more details.
</span></span><span style=display:flex><span>#
</span></span><span style=display:flex><span>#SSLRandomSeed startup file:/dev/random  512
</span></span><span style=display:flex><span>#SSLRandomSeed startup file:/dev/urandom 512
</span></span><span style=display:flex><span>#SSLRandomSeed connect file:/dev/random  512
</span></span><span style=display:flex><span>#SSLRandomSeed connect file:/dev/urandom 512
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#
</span></span><span style=display:flex><span># When we also provide SSL we have to listen to the 
</span></span><span style=display:flex><span># standard HTTP port (see above) and to the HTTPS port
</span></span><span style=display:flex><span>#
</span></span><span style=display:flex><span>Listen 443
</span></span><span style=display:flex><span>Listen 400
</span></span><span style=display:flex><span>#ServerName www.lejinrong.cn
</span></span><span style=display:flex><span>##
</span></span><span style=display:flex><span><span style=color:#75715e>##  SSL Global Context
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>##
</span></span><span style=display:flex><span><span style=color:#75715e>##  All SSL configuration in this context applies both to
</span></span></span><span style=display:flex><span><span style=color:#75715e>##  the main server and all SSL-enabled virtual hosts.
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>##
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   SSL Cipher Suite:
</span></span><span style=display:flex><span>#   List the ciphers that the client is permitted to negotiate,
</span></span><span style=display:flex><span>#   and that httpd will negotiate as the client of a proxied server.
</span></span><span style=display:flex><span>#   See the OpenSSL documentation for a complete list of ciphers, and
</span></span><span style=display:flex><span>#   ensure these follow appropriate best practices for this deployment.
</span></span><span style=display:flex><span>#   httpd 2.2.30, 2.4.13 and later force-disable aNULL, eNULL and EXP ciphers,
</span></span><span style=display:flex><span>#   while OpenSSL disabled these by default in 0.9.8zf/1.0.0r/1.0.1m/1.0.2a.
</span></span><span style=display:flex><span>SSLCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES
</span></span><span style=display:flex><span>SSLProxyCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#  By the end of 2016, only TLSv1.2 ciphers should remain in use.
</span></span><span style=display:flex><span>#  Older ciphers should be disallowed as soon as possible, while the
</span></span><span style=display:flex><span>#  kRSA ciphers do not offer forward secrecy.  These changes inhibit
</span></span><span style=display:flex><span>#  older clients (such as IE6 SP2 or IE8 on Windows XP, or other legacy
</span></span><span style=display:flex><span>#  non-browser tooling) from successfully connecting.  
</span></span><span style=display:flex><span>#
</span></span><span style=display:flex><span>#  To restrict mod_ssl to use only TLSv1.2 ciphers, and disable
</span></span><span style=display:flex><span>#  those protocols which do not support forward secrecy, replace
</span></span><span style=display:flex><span>#  the SSLCipherSuite and SSLProxyCipherSuite directives above with
</span></span><span style=display:flex><span>#  the following two directives, as soon as practical.
</span></span><span style=display:flex><span># SSLCipherSuite HIGH:MEDIUM:!SSLv3:!kRSA
</span></span><span style=display:flex><span># SSLProxyCipherSuite HIGH:MEDIUM:!SSLv3:!kRSA
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   User agents such as web browsers are not configured for the user&#39;s
</span></span><span style=display:flex><span>#   own preference of either security or performance, therefore this
</span></span><span style=display:flex><span>#   must be the prerogative of the web server administrator who manages
</span></span><span style=display:flex><span>#   cpu load versus confidentiality, so enforce the server&#39;s cipher order.
</span></span><span style=display:flex><span>SSLHonorCipherOrder on 
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   SSL Protocol support:
</span></span><span style=display:flex><span>#   List the protocol versions which clients are allowed to connect with.
</span></span><span style=display:flex><span>#   Disable SSLv3 by default (cf. RFC 7525 3.1.1).  TLSv1 (1.0) should be
</span></span><span style=display:flex><span>#   disabled as quickly as practical.  By the end of 2016, only the TLSv1.2
</span></span><span style=display:flex><span>#   protocol or later should remain in use.
</span></span><span style=display:flex><span>SSLProtocol all -SSLv3
</span></span><span style=display:flex><span>SSLProxyProtocol all -SSLv3
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   Pass Phrase Dialog:
</span></span><span style=display:flex><span>#   Configure the pass phrase gathering process.
</span></span><span style=display:flex><span>#   The filtering dialog program (`builtin&#39; is an internal
</span></span><span style=display:flex><span>#   terminal dialog) has to provide the pass phrase on stdout.
</span></span><span style=display:flex><span>SSLPassPhraseDialog  builtin
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   Inter-Process Session Cache:
</span></span><span style=display:flex><span>#   Configure the SSL Session Cache: First the mechanism 
</span></span><span style=display:flex><span>#   to use and second the expiring timeout (in seconds).
</span></span><span style=display:flex><span>#SSLSessionCache         &#34;dbm:c:/Apache24/logs/ssl_scache&#34;
</span></span><span style=display:flex><span>SSLSessionCache        &#34;shmcb:c:/Apache24/logs/ssl_scache(512000)&#34;
</span></span><span style=display:flex><span>SSLSessionCacheTimeout  300
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   OCSP Stapling (requires OpenSSL 0.9.8h or later)
</span></span><span style=display:flex><span>#
</span></span><span style=display:flex><span>#   This feature is disabled by default and requires at least
</span></span><span style=display:flex><span>#   the two directives SSLUseStapling and SSLStaplingCache.
</span></span><span style=display:flex><span>#   Refer to the documentation on OCSP Stapling in the SSL/TLS
</span></span><span style=display:flex><span>#   How-To for more information.
</span></span><span style=display:flex><span>#
</span></span><span style=display:flex><span>#   Enable stapling for all SSL-enabled servers:
</span></span><span style=display:flex><span>#SSLUseStapling On
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   Define a relatively small cache for OCSP Stapling using
</span></span><span style=display:flex><span>#   the same mechanism that is used for the SSL session cache
</span></span><span style=display:flex><span>#   above.  If stapling is used with more than a few certificates,
</span></span><span style=display:flex><span>#   the size may need to be increased.  (AH01929 will be logged.)
</span></span><span style=display:flex><span>#SSLStaplingCache &#34;shmcb:c:/Apache24/logs/ssl_stapling(32768)&#34;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   Seconds before valid OCSP responses are expired from the cache
</span></span><span style=display:flex><span>#SSLStaplingStandardCacheTimeout 3600
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   Seconds before invalid OCSP responses are expired from the cache
</span></span><span style=display:flex><span>#SSLStaplingErrorCacheTimeout 600
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>##
</span></span><span style=display:flex><span><span style=color:#75715e>## SSL Virtual Host Context
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>##
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>&lt;<span style=color:#f92672>VirtualHost</span> <span style=color:#a6e22e>192</span><span style=color:#960050;background-color:#1e0010>.</span><span style=color:#a6e22e>168</span><span style=color:#960050;background-color:#1e0010>.</span><span style=color:#a6e22e>1</span><span style=color:#960050;background-color:#1e0010>.</span><span style=color:#a6e22e>81:400</span>&gt;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   General setup for the virtual host
</span></span><span style=display:flex><span>DocumentRoot &#34;c:/Apache24/htdocs&#34;
</span></span><span style=display:flex><span>ServerName www.lejinrong.cn
</span></span><span style=display:flex><span>ServerAdmin admin@lejinrong.cn
</span></span><span style=display:flex><span>ErrorLog &#34;c:/Apache24/logs/error.log&#34;
</span></span><span style=display:flex><span>TransferLog &#34;c:/Apache24/logs/access.log&#34;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   SSL Engine Switch:
</span></span><span style=display:flex><span>#   Enable/Disable SSL for this virtual host.
</span></span><span style=display:flex><span>SSLEngine on
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   Server Certificate:
</span></span><span style=display:flex><span>#   Point SSLCertificateFile at a PEM encoded certificate.  If
</span></span><span style=display:flex><span>#   the certificate is encrypted, then you will be prompted for a
</span></span><span style=display:flex><span>#   pass phrase.  Note that a kill -HUP will prompt again.  Keep
</span></span><span style=display:flex><span>#   in mind that if you have both an RSA and a DSA certificate you
</span></span><span style=display:flex><span>#   can configure both in parallel (to also allow the use of DSA
</span></span><span style=display:flex><span>#   ciphers, etc.)
</span></span><span style=display:flex><span>#   Some ECC cipher suites (http://www.ietf.org/rfc/rfc4492.txt)
</span></span><span style=display:flex><span>#   require an ECC certificate which can also be configured in
</span></span><span style=display:flex><span>#   parallel.
</span></span><span style=display:flex><span>SSLCertificateFile &#34;c:/Apache24/conf/ssl/server.crt&#34;
</span></span><span style=display:flex><span>#SSLCertificateFile &#34;c:/Apache24/conf/server-dsa.crt&#34;
</span></span><span style=display:flex><span>#SSLCertificateFile &#34;c:/Apache24/conf/server-ecc.crt&#34;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   Server Private Key:
</span></span><span style=display:flex><span>#   If the key is not combined with the certificate, use this
</span></span><span style=display:flex><span>#   directive to point at the key file.  Keep in mind that if
</span></span><span style=display:flex><span>#   you&#39;ve both a RSA and a DSA private key you can configure
</span></span><span style=display:flex><span>#   both in parallel (to also allow the use of DSA ciphers, etc.)
</span></span><span style=display:flex><span>#   ECC keys, when in use, can also be configured in parallel
</span></span><span style=display:flex><span>SSLCertificateKeyFile &#34;c:/Apache24/conf/ssl/server.key&#34;
</span></span><span style=display:flex><span>#SSLCertificateKeyFile &#34;c:/Apache24/conf/server-dsa.key&#34;
</span></span><span style=display:flex><span>#SSLCertificateKeyFile &#34;c:/Apache24/conf/server-ecc.key&#34;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   Server Certificate Chain:
</span></span><span style=display:flex><span>#   Point SSLCertificateChainFile at a file containing the
</span></span><span style=display:flex><span>#   concatenation of PEM encoded CA certificates which form the
</span></span><span style=display:flex><span>#   certificate chain for the server certificate. Alternatively
</span></span><span style=display:flex><span>#   the referenced file can be the same as SSLCertificateFile
</span></span><span style=display:flex><span>#   when the CA certificates are directly appended to the server
</span></span><span style=display:flex><span>#   certificate for convenience.
</span></span><span style=display:flex><span>#SSLCertificateChainFile &#34;c:/Apache24/conf/server-ca.crt&#34;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   Certificate Authority (CA):
</span></span><span style=display:flex><span>#   Set the CA certificate verification path where to find CA
</span></span><span style=display:flex><span>#   certificates for client authentication or alternatively one
</span></span><span style=display:flex><span>#   huge file containing all of them (file must be PEM encoded)
</span></span><span style=display:flex><span>#   Note: Inside SSLCACertificatePath you need hash symlinks
</span></span><span style=display:flex><span>#         to point to the certificate files. Use the provided
</span></span><span style=display:flex><span>#         Makefile to update the hash symlinks after changes.
</span></span><span style=display:flex><span>#SSLCACertificatePath &#34;c:/Apache24/conf/ssl.crt&#34;
</span></span><span style=display:flex><span>#SSLCACertificateFile &#34;c:/Apache24/conf/ssl.crt/ca-bundle.crt&#34;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   Certificate Revocation Lists (CRL):
</span></span><span style=display:flex><span>#   Set the CA revocation path where to find CA CRLs for client
</span></span><span style=display:flex><span>#   authentication or alternatively one huge file containing all
</span></span><span style=display:flex><span>#   of them (file must be PEM encoded).
</span></span><span style=display:flex><span>#   The CRL checking mode needs to be configured explicitly
</span></span><span style=display:flex><span>#   through SSLCARevocationCheck (defaults to &#34;none&#34; otherwise).
</span></span><span style=display:flex><span>#   Note: Inside SSLCARevocationPath you need hash symlinks
</span></span><span style=display:flex><span>#         to point to the certificate files. Use the provided
</span></span><span style=display:flex><span>#         Makefile to update the hash symlinks after changes.
</span></span><span style=display:flex><span>#SSLCARevocationPath &#34;c:/Apache24/conf/ssl.crl&#34;
</span></span><span style=display:flex><span>#SSLCARevocationFile &#34;c:/Apache24/conf/ssl.crl/ca-bundle.crl&#34;
</span></span><span style=display:flex><span>#SSLCARevocationCheck chain
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   Client Authentication (Type):
</span></span><span style=display:flex><span>#   Client certificate verification type and depth.  Types are
</span></span><span style=display:flex><span>#   none, optional, require and optional_no_ca.  Depth is a
</span></span><span style=display:flex><span>#   number which specifies how deeply to verify the certificate
</span></span><span style=display:flex><span>#   issuer chain before deciding the certificate is not valid.
</span></span><span style=display:flex><span>#SSLVerifyClient require
</span></span><span style=display:flex><span>#SSLVerifyDepth  10
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   TLS-SRP mutual authentication:
</span></span><span style=display:flex><span>#   Enable TLS-SRP and set the path to the OpenSSL SRP verifier
</span></span><span style=display:flex><span>#   file (containing login information for SRP user accounts). 
</span></span><span style=display:flex><span>#   Requires OpenSSL 1.0.1 or newer. See the mod_ssl FAQ for
</span></span><span style=display:flex><span>#   detailed instructions on creating this file. Example:
</span></span><span style=display:flex><span>#   &#34;openssl srp -srpvfile c:/Apache24/conf/passwd.srpv -add username&#34;
</span></span><span style=display:flex><span>#SSLSRPVerifierFile &#34;c:/Apache24/conf/passwd.srpv&#34;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   Access Control:
</span></span><span style=display:flex><span>#   With SSLRequire you can do per-directory access control based
</span></span><span style=display:flex><span>#   on arbitrary complex boolean expressions containing server
</span></span><span style=display:flex><span>#   variable checks and other lookup directives.  The syntax is a
</span></span><span style=display:flex><span>#   mixture between C and Perl.  See the mod_ssl documentation
</span></span><span style=display:flex><span>#   for more details.
</span></span><span style=display:flex><span>#&lt;Location /&gt;
</span></span><span style=display:flex><span>#SSLRequire (    %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
</span></span><span style=display:flex><span>#            and %{SSL_CLIENT_S_DN_O} eq &#34;Snake Oil, Ltd.&#34; \
</span></span><span style=display:flex><span>#            and %{SSL_CLIENT_S_DN_OU} in {&#34;Staff&#34;, &#34;CA&#34;, &#34;Dev&#34;} \
</span></span><span style=display:flex><span>#            and %{TIME_WDAY} &gt;= 1 and %{TIME_WDAY} &lt;= 5 \
</span></span><span style=display:flex><span>#            and %{TIME_HOUR} &gt;= 8 and %{TIME_HOUR} &lt;= 20       ) \
</span></span><span style=display:flex><span>#           or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
</span></span><span style=display:flex><span>#&lt;/Location&gt;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   SSL Engine Options:
</span></span><span style=display:flex><span>#   Set various options for the SSL engine.
</span></span><span style=display:flex><span>#   o FakeBasicAuth:
</span></span><span style=display:flex><span>#     Translate the client X.509 into a Basic Authorisation.  This means that
</span></span><span style=display:flex><span>#     the standard Auth/DBMAuth methods can be used for access control.  The
</span></span><span style=display:flex><span>#     user name is the `one line&#39; version of the client&#39;s X.509 certificate.
</span></span><span style=display:flex><span>#     Note that no password is obtained from the user. Every entry in the user
</span></span><span style=display:flex><span>#     file needs this password: `xxj31ZMTZzkVA&#39;.
</span></span><span style=display:flex><span>#   o ExportCertData:
</span></span><span style=display:flex><span>#     This exports two additional environment variables: SSL_CLIENT_CERT and
</span></span><span style=display:flex><span>#     SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
</span></span><span style=display:flex><span>#     server (always existing) and the client (only existing when client
</span></span><span style=display:flex><span>#     authentication is used). This can be used to import the certificates
</span></span><span style=display:flex><span>#     into CGI scripts.
</span></span><span style=display:flex><span>#   o StdEnvVars:
</span></span><span style=display:flex><span>#     This exports the standard SSL/TLS related `SSL_*&#39; environment variables.
</span></span><span style=display:flex><span>#     Per default this exportation is switched off for performance reasons,
</span></span><span style=display:flex><span>#     because the extraction step is an expensive operation and is usually
</span></span><span style=display:flex><span>#     useless for serving static content. So one usually enables the
</span></span><span style=display:flex><span>#     exportation for CGI and SSI requests only.
</span></span><span style=display:flex><span>#   o StrictRequire:
</span></span><span style=display:flex><span>#     This denies access when &#34;SSLRequireSSL&#34; or &#34;SSLRequire&#34; applied even
</span></span><span style=display:flex><span>#     under a &#34;Satisfy any&#34; situation, i.e. when it applies access is denied
</span></span><span style=display:flex><span>#     and no other module can change it.
</span></span><span style=display:flex><span>#   o OptRenegotiate:
</span></span><span style=display:flex><span>#     This enables optimized SSL connection renegotiation handling when SSL
</span></span><span style=display:flex><span>#     directives are used in per-directory context. 
</span></span><span style=display:flex><span>#SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
</span></span><span style=display:flex><span>&lt;<span style=color:#f92672>FilesMatch</span> <span style=color:#960050;background-color:#1e0010>&#34;</span>\.<span style=color:#960050;background-color:#1e0010>(</span><span style=color:#a6e22e>cgi</span><span style=color:#960050;background-color:#1e0010>|</span><span style=color:#a6e22e>shtml</span><span style=color:#960050;background-color:#1e0010>|</span><span style=color:#a6e22e>phtml</span><span style=color:#960050;background-color:#1e0010>|</span><span style=color:#a6e22e>php</span><span style=color:#960050;background-color:#1e0010>)$&#34;</span>&gt;
</span></span><span style=display:flex><span>    SSLOptions +StdEnvVars
</span></span><span style=display:flex><span>&lt;/<span style=color:#f92672>FilesMatch</span>&gt;
</span></span><span style=display:flex><span>&lt;<span style=color:#f92672>Directory</span> <span style=color:#960050;background-color:#1e0010>&#34;</span><span style=color:#a6e22e>c:</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>Apache24</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>cgi-bin</span><span style=color:#960050;background-color:#1e0010>&#34;</span>&gt;
</span></span><span style=display:flex><span>    SSLOptions +StdEnvVars
</span></span><span style=display:flex><span>&lt;/<span style=color:#f92672>Directory</span>&gt;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   SSL Protocol Adjustments:
</span></span><span style=display:flex><span>#   The safe and default but still SSL/TLS standard compliant shutdown
</span></span><span style=display:flex><span>#   approach is that mod_ssl sends the close notify alert but doesn&#39;t wait for
</span></span><span style=display:flex><span>#   the close notify alert from client. When you need a different shutdown
</span></span><span style=display:flex><span>#   approach you can use one of the following variables:
</span></span><span style=display:flex><span>#   o ssl-unclean-shutdown:
</span></span><span style=display:flex><span>#     This forces an unclean shutdown when the connection is closed, i.e. no
</span></span><span style=display:flex><span>#     SSL close notify alert is sent or allowed to be received.  This violates
</span></span><span style=display:flex><span>#     the SSL/TLS standard but is needed for some brain-dead browsers. Use
</span></span><span style=display:flex><span>#     this when you receive I/O errors because of the standard approach where
</span></span><span style=display:flex><span>#     mod_ssl sends the close notify alert.
</span></span><span style=display:flex><span>#   o ssl-accurate-shutdown:
</span></span><span style=display:flex><span>#     This forces an accurate shutdown when the connection is closed, i.e. a
</span></span><span style=display:flex><span>#     SSL close notify alert is send and mod_ssl waits for the close notify
</span></span><span style=display:flex><span>#     alert of the client. This is 100% SSL/TLS standard compliant, but in
</span></span><span style=display:flex><span>#     practice often causes hanging connections with brain-dead browsers. Use
</span></span><span style=display:flex><span>#     this only for browsers where you know that their SSL implementation
</span></span><span style=display:flex><span>#     works correctly. 
</span></span><span style=display:flex><span>#   Notice: Most problems of broken clients are also related to the HTTP
</span></span><span style=display:flex><span>#   keep-alive facility, so you usually additionally want to disable
</span></span><span style=display:flex><span>#   keep-alive for those clients, too. Use variable &#34;nokeepalive&#34; for this.
</span></span><span style=display:flex><span>#   Similarly, one has to force some clients to use HTTP/1.0 to workaround
</span></span><span style=display:flex><span>#   their broken HTTP/1.1 implementation. Use variables &#34;downgrade-1.0&#34; and
</span></span><span style=display:flex><span>#   &#34;force-response-1.0&#34; for this.
</span></span><span style=display:flex><span>BrowserMatch &#34;MSIE [2-5]&#34; \
</span></span><span style=display:flex><span>         nokeepalive ssl-unclean-shutdown \
</span></span><span style=display:flex><span>         downgrade-1.0 force-response-1.0
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#   Per-Server Logging:
</span></span><span style=display:flex><span>#   The home of a custom SSL log file. Use this when you want a
</span></span><span style=display:flex><span>#   compact non-error SSL logfile on a virtual host basis.
</span></span><span style=display:flex><span>CustomLog &#34;c:/Apache24/logs/ssl_request.log&#34; \
</span></span><span style=display:flex><span>          &#34;%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \&#34;%r\&#34; %b&#34;
</span></span><span style=display:flex><span>#指定myweb项目的wsgi.py配置文件路径  
</span></span><span style=display:flex><span>WSGIScriptAlias / D:/FundEvaluationSystem_svn1/Fund_Evaluation_System_V2/Fund_Evaluation_System/wsgi.py
</span></span><span style=display:flex><span>#配置静态变量路径
</span></span><span style=display:flex><span>Alias /static/ D:/FundEvaluationSystem_svn1/Fund_Evaluation_System_V2/static/
</span></span><span style=display:flex><span>&lt;<span style=color:#f92672>Directory</span> <span style=color:#a6e22e>D:</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>FundEvaluationSystem_svn1</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>Fund_Evaluation_System_V2</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>static</span>&gt;  
</span></span><span style=display:flex><span>    Allow from all
</span></span><span style=display:flex><span>&lt;/<span style=color:#f92672>Directory</span>&gt;
</span></span><span style=display:flex><span>DocumentRoot &#34;D:/FundEvaluationSystem_svn1/Fund_Evaluation_System_V2&#34;
</span></span><span style=display:flex><span>&lt;<span style=color:#f92672>Directory</span> <span style=color:#960050;background-color:#1e0010>&#34;</span><span style=color:#a6e22e>D:</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>FundEvaluationSystem_svn1</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>Fund_Evaluation_System_V2</span><span style=color:#960050;background-color:#1e0010>&#34;</span>&gt;  
</span></span><span style=display:flex><span>    Options Indexes FollowSymLinks
</span></span><span style=display:flex><span>    AllowOverride None
</span></span><span style=display:flex><span>&lt;/<span style=color:#f92672>Directory</span>&gt;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>&lt;/<span style=color:#f92672>VirtualHost</span>&gt;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>&lt;<span style=color:#f92672>VirtualHost</span> <span style=color:#a6e22e>192</span><span style=color:#960050;background-color:#1e0010>.</span><span style=color:#a6e22e>168</span><span style=color:#960050;background-color:#1e0010>.</span><span style=color:#a6e22e>1</span><span style=color:#960050;background-color:#1e0010>.</span><span style=color:#a6e22e>81:443</span>&gt;
</span></span><span style=display:flex><span>DocumentRoot &#34;c:/Apache24/htdocs&#34;
</span></span><span style=display:flex><span>ServerName www.lejinrong.cn
</span></span><span style=display:flex><span>ServerAdmin admin@lejinrong.cn
</span></span><span style=display:flex><span>ErrorLog &#34;c:/Apache24/logs/error.log&#34;
</span></span><span style=display:flex><span>TransferLog &#34;c:/Apache24/logs/access.log&#34;
</span></span><span style=display:flex><span>SSLEngine on
</span></span><span style=display:flex><span>SSLCertificateFile &#34;c:/Apache24/conf/ssl/server.crt&#34;
</span></span><span style=display:flex><span>SSLCertificateKeyFile &#34;c:/Apache24/conf/ssl/server.key&#34;
</span></span><span style=display:flex><span>&lt;<span style=color:#f92672>FilesMatch</span> <span style=color:#960050;background-color:#1e0010>&#34;</span>\.<span style=color:#960050;background-color:#1e0010>(</span><span style=color:#a6e22e>cgi</span><span style=color:#960050;background-color:#1e0010>|</span><span style=color:#a6e22e>shtml</span><span style=color:#960050;background-color:#1e0010>|</span><span style=color:#a6e22e>phtml</span><span style=color:#960050;background-color:#1e0010>|</span><span style=color:#a6e22e>php</span><span style=color:#960050;background-color:#1e0010>)$&#34;</span>&gt;
</span></span><span style=display:flex><span>    SSLOptions +StdEnvVars
</span></span><span style=display:flex><span>&lt;/<span style=color:#f92672>FilesMatch</span>&gt;
</span></span><span style=display:flex><span>&lt;<span style=color:#f92672>Directory</span> <span style=color:#960050;background-color:#1e0010>&#34;</span><span style=color:#a6e22e>c:</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>Apache24</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>cgi-bin</span><span style=color:#960050;background-color:#1e0010>&#34;</span>&gt;
</span></span><span style=display:flex><span>    SSLOptions +StdEnvVars
</span></span><span style=display:flex><span>&lt;/<span style=color:#f92672>Directory</span>&gt;
</span></span><span style=display:flex><span>BrowserMatch &#34;MSIE [2-5]&#34; \
</span></span><span style=display:flex><span>         nokeepalive ssl-unclean-shutdown \
</span></span><span style=display:flex><span>         downgrade-1.0 force-response-1.0
</span></span><span style=display:flex><span>CustomLog &#34;c:/Apache24/logs/ssl_request.log&#34; \
</span></span><span style=display:flex><span>          &#34;%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \&#34;%r\&#34; %b&#34;
</span></span><span style=display:flex><span>WSGIScriptAlias / D:/FundEvaluationSystem_svn1/Fund_Evaluation_System_V3/Fund_Evaluation_System/wsgi.py
</span></span><span style=display:flex><span>Alias /static/ D:/FundEvaluationSystem_svn1/Fund_Evaluation_System_V3/static/
</span></span><span style=display:flex><span>&lt;<span style=color:#f92672>Directory</span> <span style=color:#a6e22e>D:</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>FundEvaluationSystem_svn1</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>Fund_Evaluation_System_V3</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>static</span>&gt;  
</span></span><span style=display:flex><span>    Allow from all
</span></span><span style=display:flex><span>&lt;/<span style=color:#f92672>Directory</span>&gt;
</span></span><span style=display:flex><span>DocumentRoot &#34;D:/FundEvaluationSystem_svn1/Fund_Evaluation_System_V3&#34;
</span></span><span style=display:flex><span>&lt;<span style=color:#f92672>Directory</span> <span style=color:#960050;background-color:#1e0010>&#34;</span><span style=color:#a6e22e>D:</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>FundEvaluationSystem_svn1</span><span style=color:#960050;background-color:#1e0010>/</span><span style=color:#a6e22e>Fund_Evaluation_System_V3</span><span style=color:#960050;background-color:#1e0010>&#34;</span>&gt;  
</span></span><span style=display:flex><span>    Options Indexes FollowSymLinks
</span></span><span style=display:flex><span>    AllowOverride None
</span></span><span style=display:flex><span>&lt;/<span style=color:#f92672>Directory</span>&gt;
</span></span><span style=display:flex><span>&lt;/<span style=color:#f92672>VirtualHost</span>&gt;
</span></span></code></pre></div><p>但其实 都写了跳转，所以在<code>httpd-vhosts.conf</code>文件中的项目以及静态资源路径指定就不用指定了，只不过我懒得删…
还有一个坑点就是 原本有一个指定项目路径以及python环境的语句：</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-md data-lang=md><span style=display:flex><span>#WSGIPythonPath &#34;C:/Python27/Lib;C:/Python27/Lib/site-packages;C:/Python27/DLLs&#34;
</span></span><span style=display:flex><span>#WSGIPythonPath D:/FundEvaluationSystem_svn1
</span></span><span style=display:flex><span>#WSGIPythonHome &#34;C:/Python27&#34;
</span></span></code></pre></div><p>我不知道按照上下这两种为什么会出问题，但网上那些人不会。但中间那个是用来指向项目路径的一个取巧的办法。哦因为wsgi或许我已经在别处制订过了。所以只要在<code>wsgi.py</code>中声明<code>sys.path.append('D:/FundEvaluationSystem_svn1/Fund_Evaluation_System_V2')</code>就可以将项目包括进来，而不需要通过 第二句那个制定<code>python</code>路径的东西。而用那个，会导致资源只有声明的项目1会被加载，而项目2的资源就不会声明，而将那三句话注释，只要分别在&rsquo;wsgi.py&rsquo;中声明项目资源，而在<code>.conf</code>文件中指向&rsquo;wsgi.py&rsquo;文件就可以如数加载了。</p><p>(⊙﹏⊙)语序 逻辑混乱之后不加班了再整理吧~~😭</p><h1 id=前端-vue>前端 Vue
<a class=anchor href=#%e5%89%8d%e7%ab%af-vue>#</a></h1><p><code>vue</code>的使用方式可以通过<code>html</code>页面直接引用，也能直接用<code>vue-cil</code>创建项目。 网上人称<code>vue</code>脚手架？晓不大得
而我这里自然说的就是 <code>vue-cil</code>即 通过<code>vue init webpack &lt;prjName></code>来生成的项目喽</p><p>系统的创建以及介绍之后使用再熟一些再写，现在先记一些零散的东西。 [^_^]2018年9月18日 21点36分</p><h3 id=路由配置登陆访问>路由配置登陆访问
<a class=anchor href=#%e8%b7%af%e7%94%b1%e9%85%8d%e7%bd%ae%e7%99%bb%e9%99%86%e8%ae%bf%e9%97%ae>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-vue data-lang=vue><span style=display:flex><span>    <span style=color:#a6e22e>在</span><span style=color:#e6db74>`router/index.js`</span><span style=color:#a6e22e>中</span><span style=color:#960050;background-color:#1e0010>：</span>
</span></span><span style=display:flex><span>    
</span></span><span style=display:flex><span>    {
</span></span><span style=display:flex><span>      <span style=color:#a6e22e>path</span><span style=color:#f92672>:</span> <span style=color:#e6db74>&#39;/&#39;</span>,
</span></span><span style=display:flex><span>      <span style=color:#75715e>// 首页
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>      <span style=color:#a6e22e>name</span><span style=color:#f92672>:</span> <span style=color:#e6db74>&#39;Main&#39;</span>,
</span></span><span style=display:flex><span>      <span style=color:#a6e22e>component</span><span style=color:#f92672>:</span> <span style=color:#a6e22e>Main</span>,
</span></span><span style=display:flex><span>      <span style=color:#a6e22e>meta</span><span style=color:#f92672>:</span> {
</span></span><span style=display:flex><span>        <span style=color:#a6e22e>requireAuth</span><span style=color:#f92672>:</span> <span style=color:#66d9ef>true</span>,  <span style=color:#75715e>// 添加该字段，表示进入这个路由是需要登录的
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>      }
</span></span><span style=display:flex><span>    },
</span></span></code></pre></div></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><div class=book-comments></div><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#一些问题>一些问题</a><ul><li><a href=#使用字体-zh-cn时如果报错>使用字体 <code>zh-cn</code>时如果报错:</a></li><li><a href=#时区问题>时区问题</a></li></ul></li><li><a href=#daemon-命令>daemon 命令</a><ul><li><a href=#示例如下>示例如下:</a></li></ul></li><li><a href=#利用nginxfd反向代理解决跨域问题>利用nginxfd反向代理解决跨域问题</a><ul><li></li></ul></li><li><a href=#django-的前端相关>Django 的前端相关</a><ul><li></li><li><a href=#版本>版本</a></li><li><a href=#mvc>MVC</a></li></ul></li><li><a href=#简介>简介</a><ul><li><a href=#试一下>试一下?</a></li><li><a href=#结构>结构</a></li><li><a href=#得知结构之后>得知结构之后</a></li><li><a href=#这下可以很厉害了>这下可以很厉害了</a></li></ul></li><li><a href=#我爱java-2018年6月24日16点40分的我由衷的写到>我爱Java 2018年6月24日16点40分的我由衷的写到</a><ul><li></li><li><a href=#注意>注意</a></li></ul></li><li><a href=#ssl加密https配置>SSl加密，https配置</a><ul><li><a href=#之前写的文档>之前写的文档</a></li><li><a href=#附>附</a></li></ul></li></ul><ul><li><ul><li><a href=#路由配置登陆访问>路由配置登陆访问</a></li></ul></li></ul></nav></div></aside></main></body></html>